Android
qq397162973
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
给button添加监听器(匿名内部类)
1.添加import android.widget.Button; 2.在onCreat()申明Button button; 3.定义button = (Button) findViewById(R.id.button); //此处R.id.button是在布局中button的编号 button.setOnClickListener(new View.OnClickListener() {原创 2018-02-02 15:12:21 · 4614 阅读 · 0 评论 -
跑马灯效果
法一:(使用android studio不能实现该效果,不论我是否使用singleLine,不知道怎么回事) 定义textView标签的4个属性:(最新版本淘汰singleLine和ellipsize,直接使用maxLine=1) android:singleLine="true"//使其只能单行 android:ellipsize="marquee"//去掉省略号 an原创 2018-02-02 17:07:08 · 236 阅读 · 0 评论 -
实现自动联想AutoCompleteTextView
1.添加部件 2.在java文件中申明并定义一个需要出现的数组并申明AutoCompleteTextView 3.定义AutoCompleteTextView,申明并定义一个适配器,将适配器和AutoCompleteTextView绑定 acTextView=(AutoCompleteTextView)findViewById(R.id.autoCompleteTextView2); A原创 2018-02-04 20:30:27 · 295 阅读 · 0 评论 -
用ToggleButton实现图片转换
主要:java文件中 1.申明定义ToggleButton和ImageView 2.主类继承OnCheckedChangeListener接口,实现其中的方法 @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { //实现接口,点击tb时实现的方法,图片的转换原创 2018-02-04 22:21:20 · 482 阅读 · 0 评论 -
CheckBox
1.申明并定义一个CheckBox 2.添加监听器 cb=(CheckBox)findViewById(R.id.checkBox); cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(Comp原创 2018-02-05 16:01:39 · 358 阅读 · 0 评论 -
RadioGroup实现多选一的功能
1.先布局一个RadioGroup,在这个下面布局你需要的RadioButton(的个数) 2.在java文件中,申明并定义一个RadioGroup,给RadioGroup注册监听器 rg=(RadioGroup)findViewById(R.id.radioGroup); rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChan原创 2018-02-05 21:35:08 · 1944 阅读 · 0 评论 -
android studio 五大布局
1.linearlayout,线性布局:水平或垂直2.relativelayout,相对布局:自由摆放,相对于其他组件的布局3.framelayout,帧布局:叠加摆放4.absolutelayout,绝对布局:坐标摆放,比较少用5.tablelayout,表格布局:计算器...原创 2018-02-10 21:47:16 · 2620 阅读 · 0 评论 -
Activity的生命周期(从创建到销毁的过程)
Activity的生命周期(从创建到销毁的过程):onCreate();创建onStart();运行onResume();获取焦点onPause();失去焦点onStop();暂停onDestroy();销毁onRestart();Activity的四种状态:——活动状态(Active/Running)ActivityAc处理界面的最顶端,获取焦点——暂停状态(Paused):Activity失去...转载 2018-02-10 21:50:06 · 2556 阅读 · 0 评论
分享