下記の様な画面があり、RecycleViewは高さがlayout_weightで指定されています。
これに対してRecycleViewの行データも割合で決めたいです。(RecycleViewの1/10というような形)
どの様な方法が最適なのでしょうか?
xml完結でなにか方法はありますか?
JavaコードからRecycleViewの高さを指定して行データの高さを変更する方法になるのでしょうか?
またその場合行データが10行を超えた場合RecycleViewはスクロールするような仕様を考えているのですがRecycleView自体の高さは変わってしまうのでしょうか?(スクロール分大きい扱いになってしまう?)
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="match_parent"> <TextView android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"/> <androidx.recyclerview.widget.RecyclerView android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"/> </LinearLayout>
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/05/22 11:16
2022/05/23 07:52 編集