2.29
安卓scrollview
<?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="wrap_content"
android:orientation="vertical">
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="300dp">
<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="#00ff00"/>
<View
android:layout_width="300dp"
android:layout_height="match_parent"
android:background="#00ffff" />
</LinearLayout>
</HorizontalScrollView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="#ff00ff"
/>
<View
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="#ffaaff"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>
package com.example.chapter02;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class ScrollView extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scroll_view);
}
}
浙公网安备 33010602011771号