<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.administrator.horizontalscrollview.MainActivity">

    <HorizontalScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <ImageView
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:background="#ff00ff" />

            <ImageView
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:background="#000000" />

            <ImageView
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:background="#b7a500" />

            <ImageView
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:background="#c1070e" />

            <ImageView
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:background="#ff00ff" />

            <ImageView
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:background="#000000" />

            <ImageView
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:background="#b7a500" />

            <ImageView
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:background="#c1070e" />

        </LinearLayout>


    </HorizontalScrollView>
</RelativeLayout>

效果图:

HorizontalScrollView 的使用

相关文章:

  • 2022-12-23
  • 2021-10-18
  • 2022-12-23
  • 2021-11-18
  • 2021-06-21
  • 2022-12-23
  • 2021-12-03
  • 2021-05-28
猜你喜欢
  • 2021-07-18
  • 2022-12-23
  • 2021-11-27
  • 2022-01-01
  • 2022-01-12
  • 2021-09-14
相关资源
相似解决方案