java - How to set this view? -


i want have recycler view row given figure. basically, image view of fixed dimensions. 2 text views should cover entire space should not move image view out of screen. nor should crop it. my desired layout please ignore padding , margins. except there margin between image view , 2 textviews.

what have tried :

<linearlayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:orientation="horizontal">      <relativelayout         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_weight="0.8">          <textview             android:id="@+id/tv1"             android:layout_alignparentstart="true"             android:layout_alignparenttop="true"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             />          <textview             android:layout_alignparentstart="true"             android:layout_below="@id/tv1"             android:id="@+id/tv2"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:maxlines="2"             android:ellipsize="end"/>      </relativelayout>      <imageview         android:id="@+id/img"         android:layout_weight="0.2"         android:layout_width="85dp"         android:layout_height="50dp"         android:layout_marginstart="12dp"         android:layout_centervertical="true"         android:scaletype="centercrop"/> </linearlayout> 

the problem dimensions of image view changes text in textviews. not want that. want dimensions fixed.

i have kept whole thing in relative layout unable keep margin between 2 textviews , image views.

your relativelayout should read:

<relativelayout         android:layout_width="0dp"         android:layout_height="wrap_content"         android:layout_weight="1"> 

remove android:layout_weight imageview

this stretch relativelayout fit space , keep imageview same size.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -