这是我的 xml 代码的一部分,我的问题是我应该进行哪些更改来添加滚动视图。我希望能够向下滚动活动。那么,我是否要将布局从“循环进度布局”更改为“框插入布局”,还是不相关?
<androidx.wear.widget.CircularProgressLayout 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="match_parent"
android:background="@color/black"
android:padding="@dimen/box_inset_layout_padding"
tools:context=".MainActivity6"
tools:deviceIds="wear">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/inner_frame_layout_padding"
app:boxedEdges="all"
tools:ignore="MissingPrefix">
<TextView
android:id="@+id/txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="@color/orange"
android:translationY="-70dp"
android:text="Tool Number"/>
您应该将要滚动的所有内容放入 ScrollView 中,并将单个 LinearLayout 作为第一个子元素,如下所示
<ScrollView
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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.wear.widget.CircularProgressLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:padding="@dimen/box_inset_layout_padding"
tools:context=".MainActivity6"
tools:deviceIds="wear">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/inner_frame_layout_padding"
app:boxedEdges="all"
tools:ignore="MissingPrefix">
<TextView
android:id="@+id/txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="@color/orange"
android:translationY="-70dp"
android:text="Tool Number"/>
<!-- Other Items -->
</LinearLayout>
</ScrollView>