Android控件之ScrollView用法實(shí)例分析
本文實(shí)例講述了Android控件之ScrollView用法。分享給大家供大家參考。具體如下:
ScrollView滾動(dòng)視圖是指當(dāng)擁有很多內(nèi)容,屏幕顯示不完時(shí),需要通過滾動(dòng)跳來顯示的視圖。
ScrollView只支持垂直滾動(dòng)。
以下為案例
main.xml布局文件:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/p1"
android:layout_gravity="center_horizontal"/>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/p1"
android:layout_gravity="center_horizontal"/>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/p1"
android:layout_gravity="center_horizontal"/>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/p1"
android:layout_gravity="center_horizontal"/>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/p1"
android:layout_gravity="center_horizontal"/>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/p1"
android:layout_gravity="center_horizontal"/>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/p1"
android:layout_gravity="center_horizontal"/>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/p1"
android:layout_gravity="center_horizontal"/>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/p1"
android:layout_gravity="center_horizontal"/>
</LinearLayout>
</ScrollView>
顯示效果如下圖所示:

希望本文所述對(duì)大家的Android程序設(shè)計(jì)有所幫助。
- Android 自定義 HorizontalScrollView 打造多圖片OOM 的橫向滑動(dòng)效果(實(shí)例代碼)
- android 自定義ScrollView實(shí)現(xiàn)背景圖片伸縮的實(shí)現(xiàn)代碼及思路
- Android中實(shí)現(xiàn)監(jiān)聽ScrollView滑動(dòng)事件
- android TextView不用ScrollViewe也可以滾動(dòng)的方法
- 在android中ScrollView嵌套ScrollView解決方案
- android 實(shí)現(xiàn)ScrollView自動(dòng)滾動(dòng)的實(shí)例代碼
- Android之ScrollView嵌套ListView和GridView沖突的解決方法
- android開發(fā)教程之文本框加滾動(dòng)條scrollview
- Android ScrollView滑動(dòng)實(shí)現(xiàn)仿QQ空間標(biāo)題欄漸變
- Android自定義scrollView實(shí)現(xiàn)頂部圖片下拉放大
相關(guān)文章
Android編程實(shí)現(xiàn)AIDL(跨進(jìn)程通信)的方法詳解
這篇文章主要介紹了Android編程實(shí)現(xiàn)AIDL(跨進(jìn)程通信)的方法,結(jié)合實(shí)例形式詳細(xì)分析了Android實(shí)現(xiàn)AIDL(跨進(jìn)程通信)的原理、具體流程與相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2016-06-06
android 把float轉(zhuǎn)換成Int的實(shí)例講解
今天小編就為大家分享一篇android 把float轉(zhuǎn)換成Int的實(shí)例講解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-07-07
Flutter實(shí)現(xiàn)資源下載斷點(diǎn)續(xù)傳的示例代碼
在項(xiàng)目開發(fā)中,特別是C端的產(chǎn)品,資源下載實(shí)現(xiàn)斷點(diǎn)續(xù)傳是非常有必要的。今天我們不講過多原理的知識(shí),分享下簡(jiǎn)單實(shí)用的資源斷點(diǎn)續(xù)傳2022-07-07
Android activity堆棧及管理實(shí)例詳解
這篇文章主要介紹了Android activity堆棧及管理實(shí)例詳解的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,對(duì)android activity堆棧相關(guān)知識(shí)感興趣的朋友一起學(xué)習(xí)吧2016-09-09
android獲取相冊(cè)圖片和路徑的實(shí)現(xiàn)方法
這篇文章主要介紹了android獲取相冊(cè)圖片和路徑的實(shí)現(xiàn)方法,本文介紹的是Android4.4后的方法,感興趣的小伙伴們可以參考一下2016-04-04
Android開發(fā)RecyclerView實(shí)現(xiàn)折線圖效果
這篇文章主要為大家詳細(xì)介紹了Android開發(fā)RecyclerView實(shí)現(xiàn)折線圖效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-09-09
Android開發(fā)之Socket通信傳輸簡(jiǎn)單示例
這篇文章主要介紹了Android開發(fā)之Socket通信傳輸實(shí)現(xiàn)方法,結(jié)合實(shí)例形式分析了Android socket傳輸?shù)脑?、?shí)現(xiàn)方法與相關(guān)注意事項(xiàng),需要的朋友可以參考下2017-08-08

