스크롤 가능 TextView
을 표시하기 위해 NestedScrollView
과 함께 ListView
을 사용하는 것이 좋습니다.
ListView
은 고정 된 크기로되어있어 내부의 전체 높이를 차지하지 않습니다.
레이아웃이 이렇게 보일 수 있습니다.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp"
tools:context=".SubpagesLayout.ReportResult">
<!-- first scrollView -->
<NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/edit_corner_blue"
android:gravity="center"
android:text="@string/personalInformation"
android:textColor="@android:color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/birthDate" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" TestData" />
</LinearLayout>
<ListView
android:layout_width="match_parent"
<!--set a fixed height-->
android:layout_height="80dp"
.. Other attributes
</ListView>
</LinearLayout>
</NestedScrollView>
</LinearLayout>
그리고
ListView
의 목록 항목은
TextView
스크롤 할 포함 할 수있다.
TextView
의 높이를
wrap_content
으로 설정합니다.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp"
tools:context=".SubpagesLayout.ReportResult">
<TextView
android:id="@+id/textOphthalmoscopy"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="standard instrth various settings that allow focusing and adjustment of the light source to accommodate the viewer and to evaluate various features of the fundus." />
</LinearLayout>
이제 ListView
가 하나의 항목이되며,이 목록의 기본 동작으로 스크롤됩니다.
전체 레이아웃은 NestedScrollView
을 통해 스크롤됩니다.
희망 하시겠습니까?
은, 그러나, 안드로이드에서 제공하는 NestedScrollView를 사용해보십시오 유 할 수있는 경우에 중첩 스크롤을 피하기 – Ak9637
예, 그것은 NestedScrollView입니다! 덕분에 도와 줘요,하지만 왜 NestedScrollView 피할해야합니까? –
나는 이것에 대한 기술적 인 대답을 모르지만 안드로이드는 MATERIAL UI – Ak9637