android中ToggleButton的使用
来源:互联网 发布:局域网电脑监控软件 编辑:程序博客网 时间:2024/06/05 06:37
java:
package EX05_06.txt;import android.app.Activity;import android.os.Bundle;import android.widget.CompoundButton;import android.widget.LinearLayout;import android.widget.ToggleButton;public class EX05_06 extends Activity {private ToggleButton mButton;private LinearLayout mLayout; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); initApp(); }private void initApp() {// TODO Auto-generated method stubmButton = (ToggleButton)findViewById(R.id.ToggleButton01);mLayout = (LinearLayout)findViewById(R.id.LinearLayout01);mButton.setOnCheckedChangeListener(new ToggleButton.OnCheckedChangeListener(){@Overridepublic void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {// TODO Auto-generated method stubif (isChecked) {mLayout.setOrientation(1);} else {mLayout.setOrientation(0);}}});}}
main.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" ><ToggleButtonandroid:layout_marginLeft = "20dip" android:textOn = "竖直排列"android:textOff = "横向排列"android:id="@+id/ToggleButton01" android:layout_width="100dip" android:layout_height="wrap_content"></ToggleButton><LinearLayout android:id="@+id/LinearLayout01"android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content"><Button android:text="Button01" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button><Button android:text="Button02" android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button><Button android:text="Button03" android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button></LinearLayout></LinearLayout>
- android中ToggleButton的使用
- android ToggleButton的使用
- android开发中ToggleButton的使用方法详解
- android学习之ToggleButton的使用
- Android控件ToggleButton的使用与修改
- Android Studio ToggleButton 使用
- Android的ToggleButton
- ToggleButton的使用
- ToggleButton控件的使用
- ToggleButton的使用
- ToggleButton的使用
- ToggleButton的使用
- ToggleButton的使用
- ToggleButton控件的使用
- Android控件中ToggleButton详解
- Android中ToggleButton,Switch,SeekBar,RatingBar的一些用法
- 安卓开发中ToggleButton按钮的使用
- 解决RecycylerView中使用Togglebutton崩溃的问题
- JUnit学习(1)
- DefineDosDevice函数控制虚拟驱动器
- FS_S5PC100平台上Linux Camera驱动开发详解
- Mac 基本命令
- VNC远程桌面到linux,提示connection refused(10061)解决办法
- android中ToggleButton的使用
- sudo权限更改root密码
- ActionBar之Tab的使用
- CFile类清空原有文件以及读取时末尾添加乱码的问题
- 【转】不再以讹传讹,GET和POST的真正区别
- python-urllib模块【下载图片】
- 确定和监测对接状态和类型
- I帧
- Windows中文件夹属性加密的作用?