Android控件之ScrollView用法實例分析
更新時間:2015年09月10日 10:12:37 作者:Ruthless
這篇文章主要介紹了Android控件之ScrollView用法,以完整實例形式較為詳細(xì)的分析了ScrollView控件滾動顯示的實現(xiàn)技巧,需要的朋友可以參考下
本文實例講述了Android控件之ScrollView用法。分享給大家供大家參考。具體如下:
ScrollView滾動視圖是指當(dāng)擁有很多內(nèi)容,屏幕顯示不完時,需要通過滾動跳來顯示的視圖。
ScrollView只支持垂直滾動。
以下為案例
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>
顯示效果如下圖所示:

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

