Android垂直滾動控件ScrollView使用方法詳解
更新時間:2017年08月10日 08:55:11 作者:飯飯_fan
這篇文章主要為大家詳細介紹了Android垂直滾動控件ScrollView的使用方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下
一、簡介
二、方法
1)ScrollView垂直滾動控件使用方法
1、在layout布局文件的最外層建立一個ScrollView控件
2、在ScrollView控件中加入一個LinearLayout控件,并且把它的orientation設置為vertical
3、在LinearLayout控件中放入多個裝有圖片的ImageView控件
三、代碼實例
1、效果圖
2、代碼
/Ex27ScrollView/src/fry/Activity01.java
<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="none" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/item1" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/item2" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/item3" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/item4" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/item5" /> </LinearLayout> </ScrollView>
四、注意點
1、ScrollView控件是放在layout的最外層
2、ScrollView控件中控制進度條的屬性android:scrollbars
android:scrollbars="none"
是將滾動條設置為沒有
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:
- android TextView不用ScrollViewe也可以滾動的方法
- android 實現(xiàn)ScrollView自動滾動的實例代碼
- ScrollView滾動條顏色的設置方法
- android開發(fā)教程之文本框加滾動條scrollview
- 完美解決EditText和ScrollView的滾動沖突(上)
- iOS應用開發(fā)中UIScrollView滾動視圖的基本用法總結
- android scrollview 自動滾動到頂部或者底部的實例
- Android使用HorizontalScrollView實現(xiàn)水平滾動
- iOS ScrollView嵌套tableView聯(lián)動滾動的思路與最佳實踐
- Android使用ScrollView實現(xiàn)滾動效果