安卓滚动视图ScrollView

XML 复制代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <HorizontalScrollView
        android:layout_width="wrap_content"
        android:layout_height="200dp">

        <!--水平方向的线性布局,两个子视图的颜色分别为青色和黄色-->
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="horizontal">

            <View
                android:layout_width="300dp"
                android:layout_height="match_parent"
                android:background="#aaffff"/>

            <View
                android:layout_width="300dp"
                android:layout_height="match_parent"
                android:background="#ffff00" />

        </LinearLayout>

    </HorizontalScrollView>


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

        <!--垂直方向的线性布局,两个子视图的颜色分别为绿色和橙色-->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <View
                android:layout_width="match_parent"
                android:layout_height="400dp"
                android:background="#00ff00"/>

            <View
                android:layout_width="match_parent"
                android:layout_height="400dp"
                android:background="#ffffaa" />

        </LinearLayout>

    </ScrollView>
</LinearLayout>
相关推荐
simplepeng1 天前
我们都知道但总是忽略的5个Jetpack Compose细节
android·android jetpack
刮风那天1 天前
Android 如何提高进程优先级避免被查杀?
android
修行者对6661 天前
安卓阿里云镜像
android
刮风那天1 天前
Android AMS创建进程不用Binder而用Socket?
android·java·binder
知行合一。。。1 天前
Python--05--面向对象(继承,多态)
android·开发语言·python
张小潇1 天前
AOSP15 WMS/AMS系统开发 -窗口动画源码分析
android
程序员陆业聪1 天前
Shadow核心原理:壳子Activity与代理机制的精妙设计
android
plainGeekDev1 天前
Android 开发者再不转Kotlin,真的来不及了
android·kotlin
赏金术士1 天前
第五章:数据层—网络请求与Repository
android·kotlin·compose
初雪云1 天前
让安卓发版再简单一点,体验一键自动化发布
android·运维·自动化