Text inside cardview in half

0

I would like to know how I put the text inside a cardview up.

Inmycodeitlookslikethis:

<android.support.v7.widget.CardViewandroid:id="@+id/card_view8"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:layout_gravity="center"
        android:layout_margin="5dp"
        android:background="@color/colorPrimaryDark"
        card_view:cardCornerRadius="2dp"
        card_view:contentPadding="10dp">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <TextView
                android:id="@+id/textView26"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_alignParentTop="true"
                android:text="DETALHES"
                android:layout_centerInParent="true"
                android:textAppearance="?android:attr/textAppearanceLarge" />

        </RelativeLayout>
    </android.support.v7.widget.CardView>
    
asked by anonymous 14.06.2016 / 14:34

1 answer

2

The height of the CardView is set to 50dp which does not seem to be sufficient for the height of the text.

Set the height of the CardView, RelativeLayout, and TextView to wrap_content :

<android.support.v7.widget.CardView
    android:id="@+id/card_view8"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_margin="5dp"
    android:background="@color/colorPrimaryDark"
    card_view:cardCornerRadius="2dp"
    card_view:contentPadding="10dp">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/textView26"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_alignParentTop="true"
            android:text="DETALHES"
            android:layout_centerInParent="true"
            android:textAppearance="?android:attr/textAppearanceLarge" />

    </RelativeLayout>
</android.support.v7.widget.CardView>
    
14.06.2016 / 16:09