您的位置:首页 > 移动开发 > Android开发

Android Api Demos登顶之路(102)View-->Buttons

2015-10-17 12:31 453 查看
/*这个demo演示了三种形态的按钮:正常按钮,小型按钮,开关模式的按钮 */
public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

}


activity_main.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
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="Normal" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Small"
style="?android:attr/buttonStyleSmall"/>
<ToggleButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOn="打开"
android:textOff="关闭"/>

</LinearLayout>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: