一区二区日本_久久久久久久国产精品_无码国模国产在线观看_久久99深爱久久99精品_亚洲一区二区三区四区五区午夜_日本在线观看一区二区

Android HorizontalScrollView含代碼

Android HorizontalScrollView

一個 HorizontalScrollView 是一個FrameLayout。愛掏網 - it200.com android.widget.HorizontalScrollView 類提供了水平滾動視圖的功能。愛掏網 - it200.comHorizontalScrollView用于以水平方向滾動子元素或視圖。愛掏網 - it200.comHorizontalScrollView只支持水平滾動。愛掏網 - it200.com

在垂直滾動方面,Android使用ScrollView。愛掏網 - it200.com

讓我們來實現一個簡單的 HorizontalScrollView 的例子。愛掏網 - it200.com

activity_main.xml

現在,從工具欄中拖動一個HorizontalScrollView到activity_main.xml文件中,并在其中放置一些視圖或元素。愛掏網 - it200.com

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">


    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:text="Horizontal ScrollView Example"
        android:id="@+id/textView"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" />


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="25dp">
        <HorizontalScrollView
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:id="@+id/horizontalScrollView">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal">
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="New Button1"
                    android:id="@+id/button1" />
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="New Button2"
                    android:id="@+id/button2" />

                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="New Button3"
                    android:id="@+id/button3" />
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="New Button4"
                    android:id="@+id/button4" />
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="New Button5"
                    android:id="@+id/button5" />
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="New Button6"
                    android:id="@+id/button6" />
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="New Button7"
                    android:id="@+id/button7" />
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="New Button8"
                    android:id="@+id/button8"/>
            </LinearLayout>

        </HorizontalScrollView>
    </LinearLayout>
</RelativeLayout>

Activity類

這是自動生成的代碼,我們沒有在這里編寫任何代碼。愛掏網 - it200.com

文件:MainActivity.java

package com.example.test.horizantalscrollview;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

聲明:所有內容來自互聯網搜索結果,不保證100%準確性,僅供參考。如若本站內容侵犯了原著者的合法權益,可聯系我們進行處理。
發表評論
更多 網友評論0 條評論)
暫無評論

返回頂部

主站蜘蛛池模板: 亚洲综合国产 | 久久午夜精品福利一区二区 | 99免费看 | 欧美午夜影院 | 国产网站在线播放 | 久久精品亚洲一区 | 久久国产一区 | 精品视频一区二区 | 亚洲国产欧美国产综合一区 | 成人蜜桃av | 综合另类 | 国产精品成人一区 | 伊人伊成久久人综合网站 | xx视频在线观看 | 亚州激情| 特级黄一级播放 | 爱爱免费视频 | 国产精品视频免费观看 | 日日摸夜夜添夜夜添特色大片 | 亚洲精精品 | 自拍偷拍亚洲一区 | 欧美精品一区二区免费 | 久久精品成人 | 欧美人成在线视频 | 精品一二区 | 自拍视频在线观看 | 精品国产三级 | 亚洲精品欧美 | 国产91网址 | 一区二区三区免费 | 久久国产香蕉 | 国产精品精品久久久 | 无码一区二区三区视频 | 视频一区二区三区四区五区 | 中文字幕一区二区三区精彩视频 | 色888www视频在线观看 | 亚洲毛片在线 | 成人av在线播放 | 国产视频精品在线 | 久久成 | 国产9999精品 |