У меня есть RecyclerView
, который состоит из CardView
, у которого есть TextView
и ImageView
, среди некоторых других макетов.
Проблема в том, что в некоторых разрешениях экрана TextView
отключается или запирается на следующую строку, чего я не хочу.
В других резолюциях, TextView
имеет много места.
Как организовать компоновку, чтобы было достаточно места для TextView
, а размер ImageView
будет соответствующим образом определен?
Это мой xml для элементов RecyclerView
:
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:cardview="http://schemas.android.com/apk/res-auto"
android:id="@+id/zmanCard"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
cardview:cardUseCompatPadding="false"
cardview:cardPreventCornerOverlap="false"
cardview:cardCornerRadius="4dp"
cardview:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorPrimary"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_gravity="top"
android:gravity="center"
android:orientation="vertical"
android:background="?attr/colorPrimaryDark">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/zmanCardTitle"
android:textColor="#ffffff"
android:gravity="center"
android:textSize="13sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="4dp"
android:alpha="0.8"
android:id="@+id/zmanCardImage" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="4dp">
<TextView
android:text="5:40"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:id="@+id/zmanCardTime"
android:textColor="#ffffff"
android:textSize="18sp" />
<ProgressBar
android:id="@+id/zmanProgressBar"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="top|left"
style="@style/Base.Widget.AppCompat.ProgressBar" />
</FrameLayout>
</LinearLayout>
</LinearLayout>