UI(base)-2
来源:互联网 发布:淘宝购物车营销靠谱吗 编辑:程序博客网 时间:2024/04/28 07:45
ImageView:直接继承自View,它的作用就是在街面上显示图片
(它能显示的不仅仅是图片,任何Drawable对象都可以使用ImageView来显示)
代码示例:
<ImageView android:layout_width="60dp" android:layout_height="60dp" android:src ="@drawable/wifi" android:background="#f00" android:scaleType="centerCrop" />
多选框控件 CheckBox
CheckBox:直接继承自Button,它的作用就是在界面提供一组选项,可以多选。
示例代码:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.asong.testui2.MainActivity"> <ImageView android:layout_width="60dp" android:layout_height="60dp" android:src ="@drawable/wifi" android:background="#f00" android:scaleType="centerCrop" /><LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="喜欢的颜色" /> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="红色" android:checked="true" //默认选中,每一个checkbox都能设置这种属性 /> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="蓝色" /> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="绿色" /> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="紫色" /> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="黄色" /></LinearLayout></LinearLayout>
单选框控件:RadioButton
直接继承自Button,提供一组选项,只能单选。
RadioButton要和RadioGroup一起使用
示例代码:
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="您的性别是:" /> <RadioGroup android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content"> <RadioButton android:id="@+id/btn_m" android:checked="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="男" /> <RadioButton android:id="@+id/btn_f" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="女" /> </RadioGroup> </LinearLayout>
0 0
- UI(base)-2
- UI(base)--android
- UI(base)-1
- UI(base)-3
- UI(base)-4
- UI(base)-5
- UI(base)-6
- Base ui 纯as3的ui
- Base -2
- Base-Jsp-2-JavaBeans
- uva 11121 - Base -2
- UVA 11121 Base -2
- UVa 11121 - Base -2
- uva 11121 - Base -2
- uva11121 - Base -2
- 11121 - Base -2
- UVaOJ11121 - Base -2
- Uva 11121 Base -2
- Java基础资料
- VS2005 Debug版,dll /MTd,exe /MDd 跨dll使用CString的链接错误
- App Transport Security
- Android Studio代码调试技巧篇
- jpush 第一篇 (初步认识)
- UI(base)-2
- ACdream 1188 switch教学
- SpringMVC之文件上传(进度条显示)
- J2ee项目从0搭建(二):Maven下载、安装、eclipse+maven配置
- android常用的函数、判断、正则
- leetcode 230. Kth Smallest Element in a BST
- spring和springMVC父子容器的原理
- TrueCrypt 使用经验[3]:关于加密
- iOS图片压缩处理