欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

HorizontalScrollView水平滾動(dòng)控件使用方法詳解

 更新時(shí)間:2017年08月10日 08:42:32   作者:飯飯_fan  
這篇文章主要為大家詳細(xì)介紹了HorizontalScrollView水平滾動(dòng)控件的使用方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

一、簡(jiǎn)介

用法ScrollView大致相同

二、方法

1)HorizontalScrollView水平滾動(dòng)控件使用方法

1、在layout布局文件的最外層建立一個(gè)HorizontalScrollView控件

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

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

2)HorizontalScrollView和ScrollView混合使用方法

 以先垂直后水平為例

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

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

3、在這個(gè)LinearLayout中添加多個(gè)已經(jīng)弄好的HorizontalScrollView水平滾動(dòng)控件 

三、代碼實(shí)例

HorizontalScrollView水平滾動(dòng)控件使用方法

1、水平滾動(dòng)效果圖:

2、水平滾動(dòng)代碼:

/Ex27ScrollView/res/layout/activity02.xml

<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView 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="horizontal"
    >
    <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>
  

</HorizontalScrollView>

3、水平豎直混合滾動(dòng)效果圖

3、水平豎直混合滾動(dòng)效果代碼

/Ex27ScrollView/res/layout/activity03.xml

<?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" >

    <HorizontalScrollView
      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="horizontal" >

        <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>
    </HorizontalScrollView>
    <HorizontalScrollView
      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="horizontal" >

        <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>
    </HorizontalScrollView>
    <HorizontalScrollView
      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="horizontal" >

        <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>
    </HorizontalScrollView>
    <HorizontalScrollView
      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="horizontal" >

        <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>
    </HorizontalScrollView>
    <HorizontalScrollView
      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="horizontal" >

        <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>
    </HorizontalScrollView>
  </LinearLayout>

</ScrollView>

四、注意點(diǎn)

 1、始終注意HorizontalScrollView和ScrollView的直接兒子只有一個(gè),一般都是LinearOut,保證了這個(gè),怎么用也不會(huì)錯(cuò)

 以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • 詳解Android的Splash啟動(dòng)圖的兩種動(dòng)態(tài)切換方式

    詳解Android的Splash啟動(dòng)圖的兩種動(dòng)態(tài)切換方式

    本篇文章主要介紹了詳解Android的Splash啟動(dòng)圖的兩種動(dòng)態(tài)切換方式,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-06-06
  • Android?內(nèi)存優(yōu)化知識(shí)點(diǎn)梳理總結(jié)

    Android?內(nèi)存優(yōu)化知識(shí)點(diǎn)梳理總結(jié)

    這篇文章主要介紹了Android?內(nèi)存優(yōu)化知識(shí)點(diǎn)梳理總結(jié),Android?操作系統(tǒng)給每個(gè)進(jìn)程都會(huì)分配指定額度的內(nèi)存空間,App?使用內(nèi)存來(lái)進(jìn)行快速的文件訪問(wèn)交互,長(zhǎng)時(shí)間如此便需要優(yōu)化策略,文章分享優(yōu)化知識(shí)點(diǎn)總結(jié),需要的朋友可以參考一下
    2022-06-06
  • Android接入阿里云熱修復(fù)介紹

    Android接入阿里云熱修復(fù)介紹

    大家好,本篇文章主要講的是Android接入阿里云熱修復(fù)介紹,感興趣的同學(xué)趕快來(lái)看一看吧,對(duì)你有幫助的話記得收藏一下
    2022-01-01
  • Android RecyclerView實(shí)現(xiàn)點(diǎn)擊條目刪除

    Android RecyclerView實(shí)現(xiàn)點(diǎn)擊條目刪除

    這篇文章主要為大家詳細(xì)介紹了Android RecyclerView實(shí)現(xiàn)點(diǎn)擊條目刪除,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-11-11
  • Android自定義樣式圓角dialog對(duì)話框

    Android自定義樣式圓角dialog對(duì)話框

    這篇文章主要為大家詳細(xì)介紹了Android自定義樣式圓角dialog對(duì)話框,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-11-11
  • android實(shí)現(xiàn)將位置信息寫(xiě)入JPEG圖片文件

    android實(shí)現(xiàn)將位置信息寫(xiě)入JPEG圖片文件

    下面小編就為大家?guī)?lái)一篇android實(shí)現(xiàn)將位置信息寫(xiě)入JPEG圖片文件。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-03-03
  • Android布局技巧之合并布局

    Android布局技巧之合并布局

    這篇文章主要為大家詳細(xì)介紹了Android布局技巧之合并布局,感興趣的小伙伴們可以參考一下
    2016-06-06
  • Android使用OKHTTP解析JSON數(shù)據(jù)的實(shí)例代碼

    Android使用OKHTTP解析JSON數(shù)據(jù)的實(shí)例代碼

    本篇文章主要介紹了Android使用OKHTTP解析JSON數(shù)據(jù)的實(shí)例代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-07-07
  • Android 接收微信、QQ其他應(yīng)用打開(kāi)第三方分享功能

    Android 接收微信、QQ其他應(yīng)用打開(kāi)第三方分享功能

    這篇文章主要介紹了Android 接收微信、QQ其他應(yīng)用打開(kāi),第三方分享 ,思路很簡(jiǎn)單通過(guò)在AndroidManifest.xml注冊(cè)ACTION事件,在用于接收分享的Activity里面加接收代碼,感興趣的朋友可以一起學(xué)習(xí)下
    2022-11-11
  • Android實(shí)現(xiàn)文本排版

    Android實(shí)現(xiàn)文本排版

    這篇文章主要介紹了Android實(shí)現(xiàn)文本排版,對(duì)多行文本進(jìn)行排版布局,每一行的內(nèi)容又分為兩部分,左邊為標(biāo)題,右邊為描述,左邊內(nèi)容長(zhǎng)度不確定,右邊的內(nèi)容需要對(duì)齊,需要的朋友可以參考下
    2016-04-04

最新評(píng)論