之前在github发现的一个很酷的android界面库 android-boostrap ,里面包括了一些boostrap样式的按钮(Bootstrap v3),输入框,略缩图背景样式,而且还支持Font Awesome v4的textview(其实更像是imageview);
效果图:
其中的BootstrapButton和BootstrapEditText比较有利用价值,在不同版本的android系统下可以保持统一的风格。
我们可以很方便的在layout中引用他们,例如:
<com.beardedhen.androidbootstrap.BootstrapEditText
android:id="@+id/editText_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="14dp"
android:layout_toRightOf="@+id/imageView1"
android:ems="10"
android:hint="@string/user_name"
android:singleLine="true"
android:text="fans"
bootstrapbutton:be_roundedCorners="true"
bootstrapbutton:be_state="warning">
<com.beardedhen.androidbootstrap.BootstrapButton
android:id="@+id/btn_login"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/linearLayout1"
android:layout_centerHorizontal="true"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:text="@string/login"
bootstrapbutton:bb_icon_left="fa-check"
bootstrapbutton:bb_roundedCorners="true"
app:bb_text_gravity="center"
bootstrapbutton:bb_type="primary"/>
icon属性中我们可以设置Font Awesome中的各种icon,具体可以从该页面中中获取:http://fortawesome.github.io/Font-Awesome/cheatsheet/
而具体的使用技巧可以到github主页中下载sample研究