android - Container, Image and Text: How to get it working together? -


well, have container, image , texts (inside container), way:

<relativelayout     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:padding="5dp"     android:layout_margin="10dp"     android:id="@+id/btn">      <imageview         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:id="@+id/background"         android:src="@drawable/background"         android:scaletype="centercrop"/>      <linearlayout         android:orientation="horizontal"         android:layout_width="fill_parent"         android:layout_height="wrap_content">          <imageview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:src="@drawable/icon_left"             android:layout_gravity="center_vertical" />          <linearlayout             android:orientation="vertical"             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:layout_gravity="center_vertical">              <textview                 android:layout_height="wrap_content"                 android:layout_width="wrap_content"                 custom:fontstyle="bold"                 android:textsize="@dimen/textsizesmall"                 android:text="header" />              <textview                 android:layout_height="wrap_content"                 android:layout_width="wrap_content"                 custom:fontstyle="regular"                 android:textsize="@dimen/textsizemicro"                 android:text="body" />         </linearlayout>      </linearlayout> </relativelayout> 

the image associated imageview (yes, background image) bigger height of text together. thus, "crop" inside relativelayout. but imageview take full size when set fill_parent. :(

what can do?

p.s.: tried use image background of relativelayout. not working also.

pleaaase, help!!

use framelayout instead of relativelayout background image same size of textview.

edit

i've got answer here . can relativelayout using layout_aligntop , layout_alignbottom. sorry first wrong answer.

<relativelayout     android:layout_width="match_parent"     android:layout_height="match_parent"     xmlns:android="http://schemas.android.com/apk/res/android" >      <imageview         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:id="@+id/background"         android:src="@drawable/background"         android:scaletype="centercrop"         android:layout_aligntop="@+id/text_container"         android:layout_alignbottom="@+id/text_container"/>      <linearlayout         android:id="@+id/text_container"         android:orientation="vertical"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_gravity="left">          <textview             android:layout_height="wrap_content"             android:layout_width="wrap_content"             android:text="header" />          <textview             android:layout_height="wrap_content"             android:layout_width="wrap_content"             android:text="body" />     </linearlayout> </relativelayout> 

hope useful you.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -