Tuesday, February 9, 2016

Android Button Style like Bootstrap

Updated:



Now the library already available on JCenter and can be include this library into app.gradle dependencies

Gradle :
compile 'com.app.infideap.stylishwidget:stylish-widget:1.3.3'

Maven :
<dependency>
  <groupId>com.app.infideap.stylishwidget</groupId>
  <artifactId>stylish-widget</artifactId>
  <version>1.3.3</version>
  <type>pom</type>
</dependency>



Also can clone the code from Github.



Here I come,

It's be a long time since last time I wrote a post. Okay, for this post, I would like to share the Android resource file was I created during my previous project. This resource file I use as a style in Android interface and the UI look like bootstrap button. Here the example UI,



The available style in this resource file is :
  • Button.Default
  • Button.Primary
  • Button.Info
  • Button.Success
  • Button.Warning
  • Button.Danger
  • Button.Accent

How to use it :

Firstly, what you need to do is download this compress file,

After download it, extract the file and transfer it to your project /res folder.
Then, you already can use it.


let's say you have a button tag like this,
<Button 
android:width:"match_parent"
android:height:"wrap_content"
android:text:"Click Me" />

To use the style, just need add this line of code (android:style:"@style/<Style>") in the button tag like this,
<Button 
android:width:"match_parent"
android:height:"wrap_content"
android:text:"Click Me"
android:style:"@style/Button.Success" />

After adding the style, you can view it at the XML layout design or just run it. The button will look same like the success button below.



Before the end of the post, here I share the project code for above application, "Stylish Button" :
download




If you wanna discuss it, you may start post it at below comment box, and
If you have problem or something to ask that related to java...
you can email or comment on this post...
I will try to find the solution and share it with you..

Created By : Z-man, 2015

No comments:

Post a Comment