Android垂直滾動控件ScrollView使用方法詳解

一、簡介

成都創(chuàng)新互聯(lián)專注于企業(yè)營銷型網(wǎng)站、網(wǎng)站重做改版、額爾古納網(wǎng)站定制設(shè)計、自適應品牌網(wǎng)站建設(shè)、H5技術(shù)、成都商城網(wǎng)站開發(fā)、集團公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應式網(wǎng)頁設(shè)計等建站業(yè)務,價格優(yōu)惠性價比高,為額爾古納等各大城市提供網(wǎng)站開發(fā)制作服務。

Android垂直滾動控件ScrollView使用方法詳解

二、方法

1)ScrollView垂直滾動控件使用方法

1、在layout布局文件的最外層建立一個ScrollView控件

2、在ScrollView控件中加入一個LinearLayout控件,并且把它的orientation設(shè)置為vertical

3、在LinearLayout控件中放入多個裝有圖片的ImageView控件

三、代碼實例

1、效果圖

Android垂直滾動控件ScrollView使用方法詳解

Android垂直滾動控件ScrollView使用方法詳解

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"

是將滾動條設(shè)置為沒有

Android垂直滾動控件ScrollView使用方法詳解

 以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持創(chuàng)新互聯(lián)。

網(wǎng)站標題:Android垂直滾動控件ScrollView使用方法詳解
URL分享:http://bm7419.com/article18/goicgp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供面包屑導航、網(wǎng)站排名、網(wǎng)站導航、網(wǎng)站設(shè)計、動態(tài)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站