安卓滚动视图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>
相关推荐
大圣编蚕4 小时前
初探 NDK 的世界:从零开始理解 Android 原生开发
android
云贝贝贝4 小时前
MySQL 慢查询定位与索引优化实战
android
骑着蜗牛撵大象3275 小时前
服务下线不再炸:分层关闭、TCP 存活探测与负载均衡排水的落地套路
android·tcp/ip·负载均衡·tcp·高可用·健康检查·优雅关闭
三少爷的鞋7 小时前
别再这么写协程了!Marcin Moskała 剖析的 几个常见协程误区与重构
android
mmsx9 小时前
Android 防二次打包第一道锁:签名校验与完整性校验
android·kotlin
mmsx9 小时前
Android 混淆不等于安全:二次打包链路完整走一遍
android·kotlin
小宋102110 小时前
Agent轨迹级评测实战:工具选择、预算超限与回归门禁
android·网络·人工智能·回归
墨天梦12 小时前
D05_ViewModel与单向数据流
android·kotlin
蒸鱼Yuzheng14 小时前
Android 构建可复现性:APK 指纹、文件级差异与供应链审计
android·apk·devops·软件供应链·可复现构建
墨天梦16 小时前
D03_Compose列表与稳定身份
android·gitee·kotlin