Android的ToggleButton
2016-01-01 22:09
253 查看
代码如下
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <ToggleButton android:id="@+id/btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textOff="横向" android:textOn="纵向" android:checked="true" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="测试" /> </LinearLayout>
package com.example.test03; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } }
相关文章推荐
- android属性大全
- Android的CheckBox复选框
- Android的sdk下载问题
- Android中常用单位(dpi、px、dp、sp)
- Android中ImageView.ScaleType属性值
- Android的ImageView图片
- android使用include调用内部组件报空指针异常解决方案
- Android开发 更改返回button的图标
- Android开发-百度地图(一)——准备
- android-自定义-悬浮控件
- Android 图片的内存优化
- Android Volley完全解析(四),带你从源码的角度理解Volley
- Android下的单元測试
- Android Volley完全解析(二)
- Unable to run mksdcard SDK tool
- android-gif-drawable 无效 失效 不能用 not working
- 【Qt for Android】OpenGL ES 绘制彩色立方体
- 最近使用Android studio 2.0 遇见的一些问题
- Android笔记(七十) AlertDialog
- Android 相机 I-调用已存在的拍摄应用/系统相机