安卓滚动视图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>
相关推荐
whysqwhw25 分钟前
OkHttp深度架构缺陷分析与演进规划
android
用户70937225385127 分钟前
Android14 SystemUI NotificationShadeWindowView 加载显示过程
android
木叶丸1 小时前
跨平台方案该如何选择?
android·前端·ios
顾林海2 小时前
Android ClassLoader加载机制详解
android·面试·源码
用户2018792831672 小时前
🎨 童话:Android画布王国的奇妙冒险
android
whysqwhw2 小时前
OkHttp框架的全面深入架构分析
android
你过来啊你2 小时前
Android App冷启动流程详解
android
泓博3 小时前
KMP(Kotlin Multiplatform)改造(Android/iOS)老项目
android·ios·kotlin
移动开发者1号3 小时前
使用Baseline Profile提升Android应用启动速度的终极指南
android·kotlin
移动开发者1号4 小时前
解析 Android Doze 模式与唤醒对齐
android·kotlin