어떻게 든 RecyclerView를 사용하여이 작업을 수행 할 수있었습니다. RecyclerView에서 특정 항목에 대한보기를 만들 때 recyclerview 항목 레이아웃이 parent와 일치합니다.ScrollView의 첫 번째 뷰를 화면에 대한 치수와 일치시킬 수 있습니까?
이 또한 ScrollView를 사용하여 가능합니까?
는 여기에 지금까지 무슨 짓을했는지 :
있는 ScrollView의 XML :
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/scrollview_homescreen"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout
android:id="@+id/linearlayout_homescreen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/listitem_comic_menu"/>
<LinearLayout
android:id="@+id/linearlayout_comic_listings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</LinearLayout>
</ScrollView>
내용 : 그래서
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativelayout_homescreen"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageview_menu_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:adjustViewBounds="true" />
<ImageView
android:id="@+id/imageview_menu_title_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/starwars_webtoon_home_1_logo"
android:scaleType="fitXY"
android:adjustViewBounds="true" />
<Button
android:id="@+id/button_start_reading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_above="@+id/button_menu"
android:layout_marginBottom="18dp"
android:text="@string/button_start_reading"
android:gravity="start"
android:drawableRight="@drawable/ic_keyboard_arrow_right_black_24dp"
android:drawableEnd="@drawable/ic_keyboard_arrow_right_black_24dp"
android:background="@drawable/button_bg"
android:textSize="18sp"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginEnd="12dp"
android:layout_marginRight="12dp" />
<Button
android:id="@id/button_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="28dp"
android:text="@string/button_menu"
android:textSize="18sp"
android:textColor="#FFFFFF"
android:drawableLeft="@drawable/ic_menu_white_24dp"
android:drawableStart="@drawable/ic_menu_white_24dp"
android:background="?android:attr/selectableItemBackground" />
</RelativeLayout>
내가 뭘하려고 오전? 기본적으로 이것은 만화 목록입니다. 첫 번째 항목은 홈 화면, 여기 저기에있는 단추 두 개와 전체 응용 프로그램 로고 여야합니다. 다음 항목은 목록 (동일한 너비와 높이의 40 개 항목이 있음)과 꼬리말을 표시해야합니다.
화면 인 부모와 일치시키기 위해 홈 화면이 필요합니다. 따라서 맨 위 부분을 스크롤하면 첫 번째 항목 (홈 화면 인 첫 번째보기)이 전체 장치 화면을 채 웁니다.
나는 이것을 RecyclerView에서 할 수 있었고 멋지게 보였다. 나는 내가 시스템을 해킹하고 있고, RecyclerView가 실제로 이런 종류의 경우에 가장 적합한 레이아웃이 아니라는 사실을 광범위하게 고쳐야 만하는 문제점을 안게되었다. 현재 ScrollView로 전환하고 동적으로/정적으로 만화 항목을 추가할지 여부를 결정하고 있습니다. 그러나 첫 번째보기 인 홈 화면이 화면 장치와 일치하지 않습니다.
ScrollView에서이 작업을 수행 할 수 있는지 궁금한 점이 있습니까?
감사합니다.
? 나는 아직도 차원을 요구할 때 중력이 여기서 어떻게 도울 수 있는지 이해하기 위해 고심하고있다. –
@Saret를 사용해야합니다 –
미안하지만 중력이 아닌 "무게"를 의미합니다. listitem_comic_menu의 상대 레이아웃에 android : weight = "1"을 추가 할 수 있습니다. –