一些基础的控件
来源:互联网 发布:c语言windows窗口程序 编辑:程序博客网 时间:2024/05/19 22:02
1、Switch
2、RadioButton
<Switch android:id="@+id/switch1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/button1" android:layout_below="@+id/button1" android:layout_marginTop="58dp" android:text="wifi" />
1.1、获取到该控件
Switch btnSwitch=(Switch) findViewById(R.id.switch1);
2、RadioButton
<RadioButton android:id="@+id/radio0" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:checked="true" android:button="@null" android:textColor="#ffffffff" android:drawableTop="@drawable/ic_launcher" android:text="推荐" android:gravity="center_horizontal"/>3、ScrollView(内部可以装一个组件,就会具有滑动的效果了)
<ScrollView android:layout_width="match_parent" android:layout_height="match_parent"></ScrollView>4、搜索框SearchView
<SearchView android:id="@+id/searchView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" > </SearchView>4.1、用特殊的方法来设置SearchView的blackGround
private void setSearchView() {SearchView sv = (SearchView) findViewById(R.id.searchView1);sv.onActionViewExpanded();// 默认展开// 获得字符串指定的资源idint id = sv.getResources().getIdentifier("android:id/search_plate",null, getPackageName());// 根据id找到对应的布局LinearLayout layout = (LinearLayout) sv.findViewById(id);// 设置layout的背景layout.setBackgroundResource(R.drawable.editor_background_01);// 添加监听器sv.setOnQueryTextListener(this);}4.2、位searchView设置OnQueryTextListener监听器
/** 输入完成点击软键盘的搜索按钮时执行此方法 */@Overridepublic boolean onQueryTextSubmit(String query) {Log.i("TAG", "onQueryTextSubmit.query=" + query);return false;}/** 输入框内容发生变化会执行此方法 */@Overridepublic boolean onQueryTextChange(String newText) {Log.i("TAG", "onQueryTextChange.newText=" + newText);adapter.getFilter().filter(newText);return true;}5、各种进度条(Bar)
<ProgressBar android:id="@+id/progressBar1" style="?android:attr/progressBarStyleLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="32dp" android:layout_marginTop="24dp" /> <ProgressBar android:id="@+id/progressBar2" style="?android:attr/progressBarStyleHorizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_below="@+id/progressBar1" android:layout_marginTop="15dp" /> <!-- 拖动条 --> <SeekBar android:id="@+id/seekBar1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/progressBar2" android:layout_marginTop="46dp" /> <!-- ratingbar --> <RatingBar android:id="@+id/ratingBar1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/seekBar1" android:layout_below="@+id/seekBar1" android:layout_marginTop="44dp" />
0 0
- 一些基础的控件
- ASP.NET一些基础控件的实践
- 展讯 List控件的一些基础结构
- qt入门--一些基础控件的应用
- 基础控件 UIControl的一些用法
- 控件的一些处理
- android的一些控件
- 控件的一些使用
- 一些控件的使用
- Android的一些控件
- 一些常用的控件
- iOS开发 一些基础控件知识
- AJAX的基础控件.
- detailview的控件基础
- 基础控件的使用
- Android的基础控件
- win8开发笔记:XAML一些基础控件值的获取方式
- 一些基础的精华
- C++ 线程池实现原理
- 数据结构_P11
- 项目管理:沟通与沟通计划
- Linked List Cycle
- Spark定制班第21课:Spark Streaming中动态Batch Size深入及RateController解析
- 一些基础的控件
- Java-文本下载
- java写的TCP局域网聊天系统
- hibernate基于泛型基础增删改查方法封装
- 基因数据处理70之Picard安装没成功
- 二、工厂模式
- Linux 空闲空间的格式化与加载
- 1045
- USACO Section 2.3