Всем привет! Посоветуйте пожалуйста как можно создать такой список как на скринах. Пробовал на ListView
, TableLayot
, LinearLayout
, ExpandableListview
.
Проблема что не могу растянуть на весь экран.Первые 2 скрина это скрин работающей програмы из интернета это то к чему стремлюсь.
//Это код в фрагменте который показывет представление дневника
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ExpandableListView
android:id="@+id/expListView"
android:groupIndicator="@color/btn"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ExpandableListView>
</RelativeLayout>
//Это xml кторый вызываеться для заполнение листа
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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">
<LinearLayout
android:id="@+id/lin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@drawable/vrec"
tools:ignore="MissingConstraints">
<LinearLayout
android:id="@+id/linear"
android:layout_width="50dp"
android:layout_height="match_parent"
android:background="@color/linnn"
android:orientation="vertical">
<TextView
android:id="@+id/day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/play"
android:text="@string/pn"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
android:id="@+id/num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="@font/play"
android:gravity="center"
android:text="1"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/play"
android:text="month"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/spisok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="24sp"
android:layout_marginTop="10dp"
android:fontFamily="@font/play"
android:text="Spisok del:"
android:textColor="@color/black"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="80dp"
android:orientation="horizontal">
<TextView
android:id="@+id/dop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_marginTop="10dp"
android:fontFamily="@font/play"
android:text="2"
android:textColor="@color/black"
android:textSize="14sp" />
<TextView
android:id="@+id/slash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="@font/play"
android:text="/"
android:textColor="@color/black"
android:textSize="14sp" />
<TextView
android:id="@+id/pisly"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="@font/play"
android:text="9"
android:textColor="@color/black"
android:textSize="14sp" />
<ProgressBar
android:id="@+id/progressBar123"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="7dp"
android:layout_marginLeft="21dp"
android:layout_marginTop="15dp"
android:progress="50"
android:progressDrawable="@drawable/drawable_progress_bar" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/plus"
android:layout_width="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:src="@drawable/addtask15050"
android:layout_alignParentRight="true" />
<ListView
android:id="@+id/dayList"
android:layout_below="@+id/lin"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
И вот так на телефоне та выходит. Если маленькое количество пикселей на дюйм то список кидает в скрол а не масштабирует элемент под экран. Если делать через LinearLayout и android:layout_weight="" то список при открытии просто сжимает без скролла
layout_height="match_parent"
? Ответ на похожий вопрос вам может пригодиться, если необходимо оставить неизменной верхнюю панель, а список растянуть