1
There is a way to make a Linearlayout to have the same height as a Textview?
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/blue"/>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
app:srcCompat="@drawable/edit"/>
<ImageView
android:id="@+id/lista_imagem"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
app:srcCompat="@drawable/avatar"
android:layout_marginStart="5dp" />
<TextView
android:id="@+id/lista_nome"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/lista_imagem"
android:layout_toRightOf="@+id/lista_imagem"
android:text="Titulo"
android:textSize="12sp"
android:textStyle="bold" />
I wanted the
android:layout_height=""
My linear layout had the same size as Textview lista_nome
, remembering that this should be wrap_content
because the text changes size. Is there a way to do this? I know that by dimen you define a default value, but there would be a way to make that value equal to Textview, for example?
Edit: Textview cannot be inside this Linearlayout
Thank you very much ramaral, it worked here
– Woton Sampaio