bearded-hen / android-bootstrap Goto Github PK
View Code? Open in Web Editor NEWBootstrap style widgets for Android, with Glyph Icons
License: MIT License
Bootstrap style widgets for Android, with Glyph Icons
License: MIT License
hello , i was thinkng if i can use font awesome texts as icons for my menu item , please can you help me with that ?
thanks
This feature probably needs the most discussion and it really is for the benefit of the developer rather than the user. I added styles for BootstrapButton and BootstrapEditText.
Advantages:
<style name="BootstrapButton" parent="android:style/Widget.Button"> <item name="android:padding">8dp</item> <item name="android:textSize">14sp</item> <item name="bb_roundedCorners">true</item> </style>
gives each BootstrapButton 8dp padding, 14sp font, and round corners by default. The user can override all these by just doing what he would normally do in the layout xml file. As you can see, custom attributes can be placed in here as well i.e "bb_roundedCorners". It is much easier for the developer to just change settings here than it is to go into the java code and change stuff.
It isn't a huge deal though because there aren't too many defaults to set for BootstrapButtons. But it may make it easier if more widgets get added.
Disadvantage:
<item name="bootstrapButtonStyle">@style/BootstrapButton</item> <item name="bootstrapEditTextStyle">@style/BootstrapEditText</item>
So it would end up looking like this after the above 2 lines are added:
<style name="AppTheme" parent="AppBaseTheme"> <item name="bootstrapButtonStyle">@style/BootstrapButton</item> <item name="bootstrapEditTextStyle">@style/BootstrapEditText</item> </style>
I think it's a fair tradeoff, but if more widgets are added to Android Bootstrap with styles, you need to add each one like above. But in the end, it just ends up being a copy and paste by the user, so it will take less than 10 seconds.
I also removed the need for the user to have to download the FontAwesome font and put it into their project. So it evens out kind of. I am 50/50 on this feature. I think it's awesome for developers because it is easier to make changes. But without it, it is nice being able to remove 2 steps for the user in order to use the library (not having to putting font in project and not having to add the styles)
Hi there,
Just had a few questions:
Why does the BootstrapButton not extend the Button class? Wouldn't this make more sense since people who have existing code with buttons only have to change the layout and all their function calls to their buttons still work.
Perhaps I am missing something?
Thanks.
Hi..im using your library in my project.. i want to show 2 buttons side by side and want them to take up the whole width of the screen,ive included your library as you said but the buttons do not stretch to fill the screen. If i try the code with normal android buttons they stretch to fill the space.can u figure out how i can overcome this.
ive tried using android:layout_weight="1" but the buttons just shift to the left and do not strech
this is the code of the button part
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="10"
android:gravity="center_horizontal|top"
android:orientation="horizontal" >
<com.beardedhen.androidbootstrap.BootstrapButton
android:id="@+id/b_yes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="center"
android:text="YES"
bootstrapbutton:bb_icon_right="fa-check"
bootstrapbutton:bb_roundedCorners="true"
bootstrapbutton:bb_type="success" />
<com.beardedhen.androidbootstrap.BootstrapButton
android:id="@+id/b_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="center"
android:text="NO"
bootstrapbutton:bb_icon_right="fa-times"
bootstrapbutton:bb_roundedCorners="true"
bootstrapbutton:bb_type="primary" />
</LinearLayout>
From the src it's com.beardedhen.bbutton
But in the example it called package com.beardedhen.androidbootstrap
In many layouts I was forced to set the layout_height of BootstrapButtons to 60dp instead of wrap_content to prevent them from taking the whole available height.
See this screenshot as an example (corresponding to https://github.com/dschuermann/openpgp-keychain/blob/master/OpenPGP-Keychain/res/layout/edit_key_key_item.xml ):
Is it possible to remove the borders from a button ?
Hi,just want see what is the Bootstrap-tab like.
I'm writing an app on the latest version of android and when I import this project and add it as a library to my existing project, there are dependency clashes due to both apps using different versions of android-support-v4.jar
Check out the change notes in the readme on my fork. I uploaded a couple screenshots as well. I made a bunch of changes and rewrote some of the base code, so merging would be difficult. Let me know what you think. I was just testing stuff out and ended up changing a bunch of stuff. Here is the fork: https://github.com/theDazzler/Android-Bootstrap
really like the buttons :) but please be aware of that there is another project with a similar name: https://github.com/donnfelker/android-bootstrap
Confusion regarding the name should be avoided...
Hi there
I've been trying to use Android-Bootstrap in my app, the buttons are great! But due to the windowNoTitle attribute in your styles.xml, apps with an ActionBar can't get one due to some code gimmick down the line in Android theming
Is this line necessary?
Thanks
Using Android-Bootstrap with actionBarSherlock gives this error as soon as bootstrap is added to main project.
error message: actionbarsherlock\res\values\abs__attrs.xml:217: error: Attribute "icon" has already been defined
I renamed the name "icon" in attrs.xml to "bootstrap_icon" to get it to work in my project. This might be something that needs changing
thanks for a great library!
I'd like to load an image into a BootstrapCircleThumbnail using the Picasso library, but I can't get access to the thumbnail's ImageView which I'd need to pass to Picasso like so:
Picasso.with(inflater.getContext()).load(group.profile_picture_url).into(imgView);
Any way the library could expose the ImageView?
keep up the great work
It would be nice to display a fontawesome icon in the circle thumbnail.
I started to implement that, but the layout of the component make it difficult (especially because of the dimensionsLabel).
Is this feature planned ?
Wouldn't be better to convert it to a jar library?
There was an issue with maven plugin version of Android-Bootstrap. After updating to Android Studio 1.0 its previews started giving NullPointerException
because of setBootstrapType
. I couldn't make any debugging without being able to see code so imported as module but now everything works fine.
Is there a way for me to test maven plugin so I can try to find why preview has been broken? If I can't preview it then it is like blind shooting views...
I am trying to retrieve the text from the button, but I cannot access the .getText method in an onClick method even when I cast the view to a BootstrapButton.
Hi!
There is a problem when using the BootstrapButton and RelativeLayout
With this activity layout https://gist.github.com/dmitre/9087804 icons are aligned incorrectly.
Thanks and sorry for bad english!
After updating the library from April to today's version, button suddenly takes up the full screen
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp"
>
<com.beardedhen.androidbootstrap.BootstrapButton
android:id="@+id/listButton1"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
bootstrapbutton:bb_icon_left="fa-list-ol"
bootstrapbutton:bb_type="default"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingBottom="5dp"
/>
<com.beardedhen.androidbootstrap.BootstrapButton
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/listButton2"
android:layout_gravity="center_horizontal"
bootstrapbutton:bb_icon_left="fa-road"
bootstrapbutton:bb_type="default"
android:paddingBottom="5dp"
android:paddingRight="5dp"
/>
</LinearLayout>
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
trying to add a bootstrap button and i get this errors
Rendering Problems The following classes could not be instantiated:
- com.beardedhen.androidbootstrap.BootstrapButton (Open Class, Show Exception)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE Exception Details java.lang.NoSuchFieldError: layout at com.beardedhen.androidbootstrap.BootstrapButton.initialise(BootstrapButton.java:186) at com.beardedhen.androidbootstrap.BootstrapButton.(BootstrapButton.java:108) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:782) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:782) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:782) at android.view.LayoutInflater.inflate(LayoutInflater.java:504) at android.view.LayoutInflater.inflate(LayoutInflater.java:385) Copy stack to clipboard
Could you update to a more recent build of gradle?
Could you check it in into Maven?
It seems like BootstrapButton try to get textSize after TypeAdapter recycled cause error "Cannot make calls to a recycled instance!".
Related code snippets in BootstrapButton:
finally {
a.recycle();
}
// blablabla
if (a.getString(R.styleable.BootstrapButton_android_textSize) == null) {
fontSize = bootstrapSize.getFontSize();
}
im not sure what is problem.
my logcat shown this log :
[warn]Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f090028}
and i found in gen R.class :
r=0x7f090028 is lblLeft Textview in BootstrapButton.java
how fix this warn?
Hey there!
Thanks for integrating with maven, but currently, i am getting a duplicate dex file for the android support library. I tried to remove the support dependency in gradle
compile ('com.beardedhen:androidbootstrap:+') {
exclude module: 'support-v4'
}
but I realized after looking into the repo that the android support jar was included directly into the libs directly. Anyway, you could change that so that support-v4 is a dependency vs a included jar?
BootstrapButton extends button. One thing I forgot to add is the default sized buttons like "small", "large", etc. I will add it if you decide you want this change.
Like this:
<com.beardedhen.androidbootstrap.BootstrapButton
android:layout_width="120dp"
android:layout_height="wrap_content"
android:text="Default"
bootstrapbutton:bb_icon_left="fa-heart"
bootstrapbutton:bb_type="default"/>
There will throw an NumberFormatException in parsing the attribute layout_width
in the BootstrapButton.
When trying to do a Gradle build, the GET for url https://github.com/donnfelker/mvn-repo/raw/master/com/android/support/appcompat-v7/ returns a 400 status code, not allowing the project to build. Is this link currently broken or just moved?
Thank you for your great work
I wanna change the size of the words in the BootstrapEditText, but it seems that the textAppearance is not work.
Forgive my poor English.
Keep the great work.
I got the hint in BootstrapEditText and it just does not appear in android 2.3
<com.beardedhen.androidbootstrap.BootstrapEditText
android:id="@+id/txtEmail"
android:layout_width="280dp"
android:layout_height="30dp"
android:layout_margin="10dp"
android:gravity="center_horizontal"
android:hint="Email"
android:inputType="textEmailAddress"
bootstrapbutton:be_roundedCorners="true" />
set BootstrapButton text in code
Sorry, I'm a Newbie of Android.
I just add
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.beardedhen:androidbootstrap:1.0.4'
}
but it show
Error:Failed to find: com.beardedhen:androidbootstrap:1.0.4
How can I solve it
hello
i'm trying to integrate the BootstrapCircleThumbnail on my list item , but when i call it i get this error error: Error parsing XML: unbound prefix.
Here is my code
<com.beardedhen.androidbootstrap.BootstrapCircleThumbnail
android:id="@+id/txt_long_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
bootstrap:bct_image="@drawable/ic_taxi_detail_phone"
bootstrap:bct_size="large" />
</LinearLayout>
i change setImage() on BootstrapCircleThumbnail.java to use universal image loader
public void setImage(int drawable)
{
Bitmap bitmap = BitmapFactory.decodeResource(getContext().getResources(), drawable);
setImage(bitmap);
}
public void setImage(Bitmap bitmap){
float scale = getResources().getDisplayMetrics().density;
//convert image size to pixels
int widthPX = (int)((this.imageWidth * scale) + 0.5);
int heightPX = (int)((this.imageHeight * scale) + 0.5);
int paddingPX = (int)((this.padding * scale) + 0.5);
if(this.minimal == false)
{
widthPX = widthPX - (paddingPX * 2);
heightPX = heightPX - (paddingPX * 2);
}
Bitmap roundBitmap = ImageUtils.getCircleBitmap(bitmap, widthPX, heightPX);
image.setImageBitmap(roundBitmap);
invalidate();
requestLayout();
}
I am creating this issue to discuss the new button colors I added. Yay or nay?
Most of them are based on these colors: http://developer.android.com/design/style/color.html
Here are the new proposed ones:
Disregard the gradient buttons for now. I'll make a new issue
hi everyone,
i have some issue to use BootStarpButton onclickListner here is my code,when i run the app it's crushed.
BootstrapButton btn2=(BootstrapButton) findViewById(R.id.button2);
//btn2.setText("1111");
btn2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent nextscreen=new Intent(getActivity().getApplicationContext(),Mellipage.class);
startActivity(nextscreen);
}
});
if anyone know how can i fix it pleas share it.
Hi!
Could I use Android-Bootstrap in gradle build system? like the following?
compile 'com.beardedhen.androidbootstrap:AndroidBootstrap:+'
Usually fill_parent should occupy the entire parent width only. But in BootstrapButton it occupy the entire parent width and height
<com.beardedhen.androidbootstrap.BootstrapButton
android:id="@+id/registerComplaintGreviance"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:orientation="vertical"
android:text="@string/register_complaint"
bootstrapbutton:bb_roundedCorners="true"
bootstrapbutton:bb_type="primary" />
I create button by following code
BootstrapButton button = new BootstrapButton(getApplicationContext());
button.setText("Test");
button.setBootstrapType("default");
button.setLeftIcon("fa-heart");
container.addView(button);
but not visible.
icon or text is still invisible after calling setText or setLeftIcon.
To reproduce, create a bootstrap button, and assign it a style that defines a text size
Sry for my english, this is mora a question than an issue, its posible to use something like BootstrapEdittext in a spinner? or woud it be posible implement "BoostrapSpinner" ?
@petehendryhen please publish aar to Maven Central,Thank You.
hello , i'm tryng to show an image on a BootstrapCircleThumbnail , but the image show's on the top of the thumbs . see the image ,
her is my xml code , the image size is : 920x360
<com.beardedhen.androidbootstrap.BootstrapCircleThumbnail
android:id="@+id/img_user"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_gravity="center_horizontal"
BootstrapCircleThumbnail:bt_image="@drawable/bg_articles_list_row_image_placeholder"
BootstrapCircleThumbnail:bct_size="large"/>
thanks
The installation guide doesn't mention anything about the font file that needs to be copied over. fontawesome-webfont.ttf
needs to be placed in your application's assets
folder.
https://github.com/Bearded-Hen/Android-Bootstrap/wiki/Installation-Guide
Using BootstrapButton in Relativelayout with :
android:layout_width="fill_parent"; android:layout_height="wrap_content"
----------------------------------the button take all the space of screen,, it has the same effect of android:layout_width="fill_parent"; android:layout_height="fill_parent"
-----------------------------------but if you use it in LinearLayout, It works fine.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.