Android垂直滾動(dòng)控件ScrollView使用方法詳解
一、簡(jiǎn)介

二、方法
1)ScrollView垂直滾動(dòng)控件使用方法
1、在layout布局文件的最外層建立一個(gè)ScrollView控件
2、在ScrollView控件中加入一個(gè)LinearLayout控件,并且把它的orientation設(shè)置為vertical
3、在LinearLayout控件中放入多個(gè)裝有圖片的ImageView控件
三、代碼實(shí)例
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>
四、注意點(diǎn)
1、ScrollView控件是放在layout的最外層
2、ScrollView控件中控制進(jìn)度條的屬性android:scrollbars
android:scrollbars="none"
是將滾動(dòng)條設(shè)置為沒(méi)有

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- android TextView不用ScrollViewe也可以滾動(dòng)的方法
- android 實(shí)現(xiàn)ScrollView自動(dòng)滾動(dòng)的實(shí)例代碼
- ScrollView滾動(dòng)條顏色的設(shè)置方法
- android開(kāi)發(fā)教程之文本框加滾動(dòng)條scrollview
- 完美解決EditText和ScrollView的滾動(dòng)沖突(上)
- iOS應(yīng)用開(kāi)發(fā)中UIScrollView滾動(dòng)視圖的基本用法總結(jié)
- android scrollview 自動(dòng)滾動(dòng)到頂部或者底部的實(shí)例
- Android使用HorizontalScrollView實(shí)現(xiàn)水平滾動(dòng)
- iOS ScrollView嵌套tableView聯(lián)動(dòng)滾動(dòng)的思路與最佳實(shí)踐
- Android使用ScrollView實(shí)現(xiàn)滾動(dòng)效果
相關(guān)文章
flutter實(shí)現(xiàn)頁(yè)面多個(gè)webview的方案詳解
這篇文章主要為大家詳細(xì)介紹了flutter如何實(shí)現(xiàn)頁(yè)面多個(gè)webview的效果,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起了解下2023-09-09
Android基礎(chǔ)之使用Fragment控制切換多個(gè)頁(yè)面
Android官方已經(jīng)提供了Fragment的各種使用的Demo例子,在我們SDK下面的API Demo里面就包含了Fragment的各種使用例子,需要看Demo的朋友,直接看API Demo那個(gè)程序就可以了,不用到處去找。里面分開(kāi)不同功能,實(shí)現(xiàn)了不同的類(lèi)2013-07-07
Android動(dòng)態(tài)替換Application實(shí)現(xiàn)
這篇文章主要介紹了Android動(dòng)態(tài)替換Application實(shí)現(xiàn),小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-05-05
Android入門(mén)之Style與Theme用法實(shí)例解析
這篇文章主要介紹了Android入門(mén)之Style與Theme用法,非常實(shí)用的功能,需要的朋友可以參考下2014-08-08
Android PopupWindow實(shí)現(xiàn)微信右上角的彈出菜單
這篇文章主要為大家詳細(xì)介紹了Android PopupWindow實(shí)現(xiàn)微信右上角的彈出菜單,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-04-04
Android Compose實(shí)現(xiàn)伸縮ToolBar的思路詳解
這篇文章主要介紹了Android Compose之伸縮ToolBar的實(shí)現(xiàn),本文給大家分享主要實(shí)現(xiàn)思路及實(shí)現(xiàn)過(guò)程,通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),需要的朋友可以參考下2021-10-10
Flutter使用SingleTickerProviderStateMixin報(bào)錯(cuò)解決
這篇文章主要為大家介紹了Flutter使用SingleTickerProviderStateMixin報(bào)錯(cuò)解決示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-08-08

