zoukankan      html  css  js  c++  java
  • 023 Android 滚动视图(ScollView)

    1.介绍

    2.使用技巧

    3.xml文件代码

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context=".MainActivity">
    
    
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="300dp">
    
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">
    
                <TextView
                    android:id="@+id/textView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="TextView" />
    
                <ImageView
                    android:id="@+id/imageView"
                    android:layout_gravity="center"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_weight="1"
                    app:srcCompat="@mipmap/img01" />
                <ImageView
                    android:id="@+id/imageView2"
                    android:layout_gravity="center"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_weight="1"
                    app:srcCompat="@mipmap/img02" />
    
                <ImageView
                    android:id="@+id/imageView3"
                    android:layout_gravity="center"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_weight="1"
                    app:srcCompat="@mipmap/img03" />
    
                <ImageView
                    android:id="@+id/imageView4"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    app:srcCompat="@mipmap/img04" />
    
                <ImageView
                    android:id="@+id/imageView5"
                    android:layout_gravity="center"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_weight="1"
                    app:srcCompat="@mipmap/img05" />
                <ImageView
                    android:id="@+id/imageView6"
                    android:layout_gravity="center"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_weight="1"
                    app:srcCompat="@mipmap/img06" />
                <ImageView
                    android:id="@+id/imageView7"
                    android:layout_gravity="center"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_weight="1"
                    app:srcCompat="@mipmap/img07" />
    
    
            </LinearLayout>
        </ScrollView>
    
        <HorizontalScrollView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
    
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal">
    
                <TextView
                    android:id="@+id/textView8"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="TextView" />
    
                <ImageView
                    android:id="@+id/imageView9"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    app:srcCompat="@mipmap/img01" />
    
                <ImageView
                    android:id="@+id/imageView10"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    app:srcCompat="@mipmap/img02" />
    
                <ImageView
                    android:id="@+id/imageView11"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    app:srcCompat="@mipmap/img03" />
    
                <ImageView
                    android:id="@+id/imageView12"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    app:srcCompat="@mipmap/img04" />
    
                <ImageView
                    android:id="@+id/imageView13"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    app:srcCompat="@mipmap/img05" />
    
                <ImageView
                    android:id="@+id/imageView14"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    app:srcCompat="@mipmap/img06" />
    
                <ImageView
                    android:id="@+id/imageView15"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    app:srcCompat="@mipmap/img07" />
            </LinearLayout>
        </HorizontalScrollView>
    
    </LinearLayout>
  • 相关阅读:
    福大软工 · BETA 版冲刺前准备(团队)
    福大软工 · 第十一次作业
    Alpha 冲刺 (9/10)
    Alpha 冲刺 (8/10)
    Alpha 冲刺 (7/10)
    Alpha 冲刺 (6/10)
    Alpha 冲刺 (5/10)
    Alpha 冲刺 (4/10)
    福大软工1816 · 团队现场编程实战(抽奖系统)
    阿里八八β阶段Scrum(5/5)
  • 原文地址:https://www.cnblogs.com/luckyplj/p/10511186.html
Copyright © 2011-2022 走看看