android的图片添加、滚动条、单选框、多选框、跳转界面
1、图片的添加用ImageView控件:用android:background;方法添加就是改变他的背景,或者;android:src添加图片.
2、滚动条:用ScrollView :android:scrollbars="vertical"(垂直滚动条),一直让它显示的的属性是:android:fadeScrollbars="false";
android:scrollbarThumbVertical设置它的颜色。
注意一点就是:滚动条里面只能有一个子类,意思就是覆盖它的只能用一个布局去填充,
如: <ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbarThumbVertical="@android:color/holo_orange_dark"
android:scrollbars="vertical"
android:fadeScrollbars="false"
android:scrollbarSize="4dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/holo_blue_light"
android:orientation="vertical" >
.
.只能在这里面添加各种控件布局,
. 否则会有错误报告:ScrollView can host only one direct chaild
.
.
.
</LinearLayout>
</ScrollView>
3、单选框:用<radiobutton/>来定义,但是这样一旦选择了一个,选另一个就不会的话,显示两个都选中。所以要放在RodioGrop里面;
如:<RodioGrop >
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="男" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="女" />
</RodioGrop>
打印出来的结果是: O 男 O 女
这样使用才会正常.
4、多选框:用chechBox来定义:
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="抢地主" />
打印出来的结果是 : □ 抢地主
更多相关文章
- android之layout布局和ListView中的一些属性介绍
- android 控件属性大全
- Android常用布局属性
- 我的Android进阶之旅------>Android 众多的布局属性详解
- 【Android】Android控件之Seekbar拖动条的使用
- android linearlayout 把控件view置底部(放在页面最下方)
- Android 之 自定义控件用法介绍
- android布局属性之margin