I have a RecyclerView which consists of CardViews that have a TextView and 
an ImageView, among some other layouts.
The problem is, in some screen resolutions the TextView gets cut off or 
shoved to the next line, which I don't want.
In other resolutions, the TextView has plenty of room.


Small Resolutions:


<https://lh3.googleusercontent.com/-yEAq97E1q4Q/WJH8Ef19OOI/AAAAAAAAHhk/VK2Qpt1QxXMatigpwGBMZk1ANRkqObWEwCLcB/s1600/recyclerview.png>

High Resolutions:

<https://lh3.googleusercontent.com/-cK5HfU_BI0w/WJH8KPQZr1I/AAAAAAAAHho/07SnT4VL9I09-hXt3cj58zq6R2kOoEbjACLcB/s1600/recyclerview2.png>

How do I organize the layout so that there is enough room for the TextView, 
and the ImageView will be sized accordingly?

This is my xml for the RecyclerView items:


<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>



-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/74c5e6ad-7c85-4f73-85fb-be5b7e0f7e7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to