Button是android视图的基本组件,有以下常用方法:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="图片切换> //引用btnselector.xml文件,如下
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:text="图片切换"
android:background="@drawable/btnselector"/>
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="原图片"
android:background="@drawable/btn_small"/>
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="处理后的图片> //用draw9patch处理过的图片,在拉升时圆角不会改变
<Button
android:layout_width="match_parent"
android:layout_height="100dp"
android:text="图片