In my app i am using recyclerview.I want customize list data so i have made a custom adapter.Now the problem is that the view appears to be of full width in the preview window of android studio but on the device its not full width so my half data is getting cutted.
XMl
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:background="#EDEFF1">
<TextView
android:id="#+id/tv_g_name"
style="#style/text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:padding="10dp"
android:text="Ashton Kutcher" />
<ImageView
android:id="#+id/iv_g_del"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:padding="10dp"
android:src="#drawable/ic_cancellation" />
<TextView
android:id="#+id/textView33"
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_alignBottom="#+id/tv_g_name"
android:layout_toLeftOf="#+id/iv_g_del"
android:layout_toStartOf="#+id/iv_g_del"
android:background="#D6D7D9" />
<ImageView
android:id="#+id/iv_g_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/textView33"
android:layout_toStartOf="#+id/textView33"
android:padding="10dp"
android:src="#drawable/ic_cancellation" />
<TextView
android:id="#+id/textView34"
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_alignBottom="#+id/textView33"
android:layout_toLeftOf="#+id/iv_g_add"
android:layout_toStartOf="#+id/iv_g_add"
android:background="#D6D7D9" />
<TextView
android:id="#+id/textView35"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/iv_g_add"
android:background="#D6D7D9" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignTop="#+id/textView35"
android:paddingBottom="05dp"
android:paddingLeft="10dp"
android:paddingRight="05dp"
android:paddingTop="05dp"
android:src="#drawable/ic_cancellation" />
<TextView
android:id="#+id/tv_g_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imageView5"
android:layout_below="#+id/textView35"
android:layout_toEndOf="#+id/imageView5"
android:layout_toRightOf="#+id/imageView5"
android:gravity="center"
android:text="pavanh.dev#gmail.com" />
<ImageView
android:id="#+id/imageView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/tv_g_email"
android:layout_toEndOf="#+id/tv_g_email"
android:layout_toRightOf="#+id/tv_g_email"
android:paddingBottom="05dp"
android:paddingLeft="10dp"
android:paddingRight="05dp"
android:paddingTop="05dp"
android:src="#drawable/ic_cancellation" />
<TextView
android:id="#+id/tv_g_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imageView6"
android:layout_below="#+id/textView35"
android:layout_toEndOf="#+id/imageView6"
android:layout_toRightOf="#+id/imageView6"
android:gravity="center"
android:text="889845412" />
</RelativeLayout>
Please let me know where i went wrong?
Use Padding in Parent instead of margin like below and also check padding and margin of your ListView which may stop View Rendering Full width
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:layout_paddingLeft="5dp"
android:layout_paddingRight="5dp"
android:layout_marginTop="2dp"
android:background="#EDEFF1">
<TextView
android:id="#+id/tv_g_name"
style="#style/text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:padding="10dp"
android:text="Ashton Kutcher" />
<ImageView
android:id="#+id/iv_g_del"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:padding="10dp"
android:src="#drawable/ic_cancellation" />
<TextView
android:id="#+id/textView33"
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_alignBottom="#+id/tv_g_name"
android:layout_toLeftOf="#+id/iv_g_del"
android:layout_toStartOf="#+id/iv_g_del"
android:background="#D6D7D9" />
<ImageView
android:id="#+id/iv_g_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/textView33"
android:layout_toStartOf="#+id/textView33"
android:padding="10dp"
android:src="#drawable/ic_cancellation" />
<TextView
android:id="#+id/textView34"
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_alignBottom="#+id/textView33"
android:layout_toLeftOf="#+id/iv_g_add"
android:layout_toStartOf="#+id/iv_g_add"
android:background="#D6D7D9" />
<TextView
android:id="#+id/textView35"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/iv_g_add"
android:background="#D6D7D9" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignTop="#+id/textView35"
android:paddingBottom="05dp"
android:paddingLeft="10dp"
android:paddingRight="05dp"
android:paddingTop="05dp"
android:src="#drawable/ic_cancellation" />
<TextView
android:id="#+id/tv_g_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imageView5"
android:layout_below="#+id/textView35"
android:layout_toEndOf="#+id/imageView5"
android:layout_toRightOf="#+id/imageView5"
android:gravity="center"
android:text="pavanh.dev#gmail.com" />
<ImageView
android:id="#+id/imageView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/tv_g_email"
android:layout_toEndOf="#+id/tv_g_email"
android:layout_toRightOf="#+id/tv_g_email"
android:paddingBottom="05dp"
android:paddingLeft="10dp"
android:paddingRight="05dp"
android:paddingTop="05dp"
android:src="#drawable/ic_cancellation" />
<TextView
android:id="#+id/tv_g_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imageView6"
android:layout_below="#+id/textView35"
android:layout_toEndOf="#+id/imageView6"
android:layout_toRightOf="#+id/imageView6"
android:gravity="center"
android:text="889845412" />
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_content"
android:layout_marginBottom="2dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:background="#EDEFF1">
try this,
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="2dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:background="#EDEFF1">
<TextView
android:id="#+id/tv_g_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:padding="10dp"
android:text="Ashton Kutcher" />
<ImageView
android:id="#+id/iv_g_del"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:padding="10dp"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/textView33"
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_alignBottom="#+id/tv_g_name"
android:layout_toLeftOf="#+id/iv_g_del"
android:layout_toStartOf="#+id/iv_g_del"
android:background="#D6D7D9" />
<ImageView
android:id="#+id/iv_g_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/textView33"
android:layout_toStartOf="#+id/textView33"
android:padding="10dp"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/textView34"
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_alignBottom="#+id/textView33"
android:layout_toLeftOf="#+id/iv_g_add"
android:layout_toStartOf="#+id/iv_g_add"
android:background="#D6D7D9" />
<TextView
android:id="#+id/textView35"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/iv_g_add"
android:background="#D6D7D9" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignTop="#+id/textView35"
android:paddingBottom="05dp"
android:paddingLeft="10dp"
android:paddingRight="05dp"
android:paddingTop="05dp"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/tv_g_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imageView5"
android:layout_below="#+id/textView35"
android:layout_toEndOf="#+id/imageView5"
android:layout_toRightOf="#+id/imageView5"
android:gravity="center"
android:text="pavanh.dev#gmail.com" />
<ImageView
android:id="#+id/imageView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/tv_g_email"
android:layout_toEndOf="#+id/tv_g_email"
android:layout_toRightOf="#+id/tv_g_email"
android:paddingBottom="05dp"
android:paddingLeft="10dp"
android:paddingRight="05dp"
android:paddingTop="05dp"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/tv_g_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imageView6"
android:layout_below="#+id/textView35"
android:layout_toEndOf="#+id/imageView6"
android:layout_toRightOf="#+id/imageView6"
android:gravity="center"
android:text="889845412" />
</RelativeLayout>
Try using fill_parent instead of match_parent
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:background="#EDEFF1">
And in 1st TextView, you have forgotten mentioning the namespace android:style. Please rectify that.
When you create the recyclerview, you normally have the layout for the individual items in the list and then the layout that contains the actual recyclerview. The layout for the actual recyclerview might have contain some type of padding or margin which is why it doesn't fill up the screen.
You will need to check that layout and not the layout for the individual items in the list.
You have also not posted the layout that contains the recyclerview so we are not able to evaluate.
Related
im trying to put a scroll view inside a frame layout. My scroll view is not scrolling all the way to bottom. this is my xml code. It is working when i give a padding to scroll view. but i need a better answer. because giving a padding will make a white margin below my application. Thank you!
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
// this is your first layout to put the big image
// use src or backgroud image as per requirement
<LinearLayout
android:background="#drawable/bg"
android:layout_width="match_parent"
android:layout_height="180dp">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/imageView"
android:background="#drawable/overly" />
</LinearLayout>
// this is your bottom layout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffc9c9c9"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:id="#+id/relativeLayout"
android:layout_marginTop="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Anna Huffmunster"
android:id="#+id/textView2"
android:textStyle="bold"
android:textSize="20dp"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:paddingTop="40dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Colombo Sri lanka"
android:id="#+id/txt_location"
android:textSize="15dp"
android:gravity="center"
android:textStyle="italic"
android:textColor="#696969"
android:paddingBottom="7dp"
android:paddingTop="5dp"
android:layout_below="#+id/textView2"
android:layout_centerHorizontal="true" />
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/scrollView"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_below="#+id/relativeLayout"
android:layout_marginTop="12dp"
android:id="#+id/relativeLayout2">
<ImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/imageButton"
android:background="#drawable/call_button"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<ImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/imageButton2"
android:background="#drawable/chat_button"
android:layout_alignParentTop="true"
android:layout_toStartOf="#+id/imageButton"
android:layout_marginRight="30dp" />
<ImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/imageButton3"
android:background="#drawable/location_button"
android:layout_alignParentTop="true"
android:layout_toEndOf="#+id/imageButton"
android:layout_marginLeft="30dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/relativeLayout2"
android:layout_alignParentStart="true"
android:layout_marginTop="12dp"
android:id="#+id/relativeLayout3">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="“Live each day as if your life had just begun.” "
android:id="#+id/txt_status"
android:textColor="#ffd9162d"
android:textSize="12dp"
android:textStyle="italic"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/relativeLayout3"
android:layout_alignParentStart="true">
<TextView
android:text="Birthday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView3"
android:textSize="12sp"
android:layout_marginStart="75dp"
android:layout_marginTop="23dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:textColor="#000" />
<TextView
android:text="19 MAR 1992"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView4"
android:inputType="date"
android:layout_marginEnd="79dp"
android:textSize="12sp"
android:layout_alignBaseline="#+id/textView3"
android:layout_alignBottom="#+id/textView3"
android:layout_alignParentEnd="true" />
<TextView
android:text="Profession"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView5"
android:layout_below="#+id/textView3"
android:layout_alignStart="#+id/textView3"
android:layout_marginTop="20dp"
android:textColor="#000"
android:textSize="12sp" />
<TextView
android:text="Software Engineer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView6"
android:textSize="12sp"
android:maxWidth="20dp"
android:layout_alignTop="#+id/textView5"
android:layout_alignStart="#+id/textView4"
android:layout_alignEnd="#+id/textView4" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true">
<TextView
android:text="dgsdfsdfdfsdfsdfvv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView8"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" />
<TextView
android:text="dgsdfsdfdfsdfsdfvv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView11"
android:layout_below="#+id/textView8"
android:layout_alignParentStart="true" />
<TextView
android:text="dgsdfsdfdfsdfsdfvv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView9"
android:layout_below="#+id/textView11"
android:layout_alignParentStart="true" />
<TextView
android:text="dgsdfsdfdfsdfsdfvv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView10"
android:layout_below="#+id/textView9"
android:layout_alignParentStart="true" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
// This is the imageview which overlay the first LinearLayout
<ImageView
android:layout_width="122dp"
android:layout_height="122dp"
android:src="#drawable/circle_profile_pic"
android:adjustViewBounds="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="100dp"
android:background="#drawable/stroke"/>
I am writing this layout code for my listview.
Below is d code
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="5dp" >
<ImageView
android:id="#+id/thumb"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="10dp"
android:paddingBottom="10dp"
android:contentDescription="#string/app_name" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:layout_toLeftOf="#+id/arrow"
android:layout_toRightOf="#+id/thumb"
android:orientation="vertical" >
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/title"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="#color/white" />
<TextView
android:id="#+id/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="#string/desc"
android:textSize="12sp" />
</LinearLayout>
<ImageView
android:id="#+id/arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:contentDescription="#string/app_name"
android:src="#drawable/ic_action_arrow_next" />
</RelativeLayout>
In the parent element of RelativeLayout the first child element ImageView is where the problem resides, in which all the layout margin properties except layout_marginBottom is working.
What could be the problem, if someone can figure it out
Desired Image
What I have right now
Try this layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="12dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="12dp" >
<ImageView
android:id="#+id/thumb"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:contentDescription="#string/app_name" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="22dp"
android:layout_marginRight="16dp"
android:layout_toLeftOf="#+id/arrow"
android:layout_toRightOf="#+id/thumb"
android:orientation="vertical" >
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/app_name"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="#string/app_name"
android:textSize="12sp" />
</LinearLayout>
<ImageView
android:id="#+id/arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:contentDescription="#string/app_name"
android:src="#drawable/ic_launcher" />
</RelativeLayout>
try this..change ur imageview like this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp" >
<ImageView
android:id="#+id/thumb"
android:layout_width="70dp"
android:layout_height="70dp"
android:contentDescription="#string/app_name"
android:paddingBottom="10dp"
android:paddingLeft="15dp"
android:paddingRight="10dp"
android:paddingTop="20dp"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:contentDescription="#string/app_name"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/desc"
android:layout_toRightOf="#+id/thumb"
android:text="titleDsdsadasds"
android:textColor="#000000"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/arrow"
android:layout_alignLeft="#+id/title"
android:text="descsdfsdfdfsdf"
android:textSize="12sp" />
</RelativeLayout>
well i can see that you have not given any margin bottom to your imageview.Correct me if i'm wrong but i guess you want android:layout_marginBottom="10dp" instead of android:paddingBottom="10dp".So you may want to replace it like below-
<ImageView
android:id="#+id/thumb"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:contentDescription="#string/app_name" />
padding is to give spacing from inside of the view and margin for outside.
Try This
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="15dp"
android:paddingBottom="15dp" >
<ImageView
android:id="#+id/thumb"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="10dp"
android:contentDescription="#string/app_name"
android:paddingBottom="10dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:layout_toLeftOf="#+id/arrow"
android:layout_toRightOf="#+id/thumb"
android:orientation="vertical" >
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ddd"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="AAAAAA"
android:textSize="12sp" />
</LinearLayout>
<ImageView
android:id="#+id/arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:contentDescription="AAAAAAAAAAA"
android:src="#drawable/ic_launcher" />
I'm trying to use scrollview in an app, but it doesn't work, the scroll bar doesn't appear and the buttons overlap, I'm using RelativeLayout to do this, I tried by other ways, but it doesn't work too.
Does someone know what I have to do?
Here is the code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="81dp"
android:layout_height="61dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:text="#string/Texto14"
android:id="#+id/buttonHomePerfilV"
android:textColor="#ffffff"
android:background="#333399"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" />
<Button
android:layout_width="291dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/buttonIDAmizadePerfilV"
android:layout_marginBottom="70dp"
android:text="#string/Texto15"
android:id="#+id/buttonIniciarConversaPerfilV"
android:textColor="#ffffff"
android:background="#333399"
android:layout_above="#+id/buttonIDAmizadePerfilV"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="291dp"
android:layout_height="wrap_content"
android:text="#string/Texto16"
android:id="#+id/buttonIDAmizadePerfilV"
android:layout_marginBottom="20dp"
android:textColor="#ffffff"
android:background="#333399"
android:layout_alignParentBottom="true"
android:layout_alignStart="#+id/buttonIniciarConversaPerfilV" />
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="#+id/imageViewPerfilV"
android:src="#drawable/ic_launcher"
android:layout_below="#+id/buttonHomePerfilV"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="#string/Texto8"
android:id="#+id/textViewNomePerfilV"
android:layout_below="#+id/imageViewPerfilV"
android:layout_alignStart="#+id/buttonHomePerfilV" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="#string/Texto9"
android:id="#+id/textViewCursoPerfilV"
android:layout_toEndOf="#+id/buttonHomePerfilV"
android:layout_centerVertical="true"
android:layout_alignStart="#+id/textViewNomePerfilV" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="#string/Texto10"
android:id="#+id/textViewDataPerfilV"
android:layout_alignTop="#+id/textViewCursoPerfilV"
android:layout_marginTop="45dp"
android:layout_marginLeft="20dp"
android:layout_alignParentStart="true" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
Try it. I just removed Parent Layout RelativeLayout:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="#+id/buttonHomePerfilV"
style="?android:attr/buttonStyleSmall"
android:layout_width="81dp"
android:layout_height="61dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:background="#333399"
android:text="#string/Texto14"
android:textColor="#ffffff" />
<Button
android:id="#+id/buttonIniciarConversaPerfilV"
android:layout_width="291dp"
android:layout_height="wrap_content"
android:layout_above="#+id/buttonIDAmizadePerfilV"
android:layout_alignBottom="#+id/buttonIDAmizadePerfilV"
android:layout_centerHorizontal="true"
android:layout_marginBottom="70dp"
android:background="#333399"
android:text="#string/Texto15"
android:textColor="#ffffff" />
<Button
android:id="#+id/buttonIDAmizadePerfilV"
android:layout_width="291dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignStart="#+id/buttonIniciarConversaPerfilV"
android:layout_marginBottom="20dp"
android:background="#333399"
android:text="#string/Texto16"
android:textColor="#ffffff" />
<ImageView
android:id="#+id/imageViewPerfilV"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_below="#+id/buttonHomePerfilV"
android:layout_centerHorizontal="true"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/textViewNomePerfilV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/buttonHomePerfilV"
android:layout_below="#+id/imageViewPerfilV"
android:layout_marginTop="20dp"
android:text="#string/Texto8"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textViewCursoPerfilV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/textViewNomePerfilV"
android:layout_centerVertical="true"
android:layout_toEndOf="#+id/buttonHomePerfilV"
android:text="#string/Texto9"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textViewDataPerfilV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignTop="#+id/textViewCursoPerfilV"
android:layout_marginLeft="20dp"
android:layout_marginTop="45dp"
android:text="#string/Texto10"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
</ScrollView>
You cannot use a RelativeLayout inside a ScrollView put the RelativeLayout inside a LinearLayout
Try this
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Linearlayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="81dp"
android:layout_height="61dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:text="#string/Texto14"
android:id="#+id/buttonHomePerfilV"
android:textColor="#ffffff"
android:background="#333399"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" />
<Button
android:layout_width="291dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/buttonIDAmizadePerfilV"
android:layout_marginBottom="70dp"
android:text="#string/Texto15"
android:id="#+id/buttonIniciarConversaPerfilV"
android:textColor="#ffffff"
android:background="#333399"
android:layout_above="#+id/buttonIDAmizadePerfilV"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="291dp"
android:layout_height="wrap_content"
android:text="#string/Texto16"
android:id="#+id/buttonIDAmizadePerfilV"
android:layout_marginBottom="20dp"
android:textColor="#ffffff"
android:background="#333399"
android:layout_alignParentBottom="true"
android:layout_alignStart="#+id/buttonIniciarConversaPerfilV" />
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="#+id/imageViewPerfilV"
android:src="#drawable/ic_launcher"
android:layout_below="#+id/buttonHomePerfilV"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="#string/Texto8"
android:id="#+id/textViewNomePerfilV"
android:layout_below="#+id/imageViewPerfilV"
android:layout_alignStart="#+id/buttonHomePerfilV" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="#string/Texto9"
android:id="#+id/textViewCursoPerfilV"
android:layout_toEndOf="#+id/buttonHomePerfilV"
android:layout_centerVertical="true"
android:layout_alignStart="#+id/textViewNomePerfilV" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="#string/Texto10"
android:id="#+id/textViewDataPerfilV"
android:layout_alignTop="#+id/textViewCursoPerfilV"
android:layout_marginTop="45dp"
android:layout_marginLeft="20dp"
android:layout_alignParentStart="true" />
</RelativeLayout>
</linearlayout>
</scrollview>
i have item listview layout with relative layout , but when i'm set "fill_parent" height, it's seem not fill, how make it ?
this
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/layout_full"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:layout_margin="4dp"
android:background="#drawable/inbox_interface" >
<TextView
android:id="#+id/textView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="TextView" />
</LinearLayout>
<ImageView
android:id="#+id/favorite_anim"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:contentDescription="#string/favorite_anime"
android:src="#drawable/favorite_active" />
<RelativeLayout
android:id="#+id/lay_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp" >
<TextView
android:id="#+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="6dp"
android:layout_marginTop="1dp"
android:layout_toLeftOf="#+id/act_item_list"
android:layout_toRightOf="#+id/avatardetail"
android:textColor="#6495ed"
android:textSize="16sp"
android:textStyle="bold"
android:typeface="sans" />
<TextView
android:id="#+id/date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/username"
android:layout_alignRight="#+id/username"
android:layout_below="#+id/username"
android:layout_marginBottom="4dp"
android:textColor="#555555"
android:textSize="12sp"
android:textStyle="italic"
android:typeface="sans" />
<ImageView
android:id="#+id/act_item_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:contentDescription="#string/act_item_list"
android:src="#drawable/act_list" />
<com.droidersuin.project.utils.RoundedImageView
android:id="#+id/avatardetail"
android:layout_width="40dp"
android:layout_height="40dp"
android:scaleType="centerCrop"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/avatar_user" />
</RelativeLayout>
<LinearLayout
android:id="#+id/isi_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/lay_top"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/judul"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:textColor="#6495ed"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/id_tulisan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/judul"
android:visibility="gone" />
<TextView
android:id="#+id/avatar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/id_tulisan"
android:visibility="gone" />
<TextView
android:id="#+id/kordinat_lokasi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/avatar"
android:visibility="gone" />
<TextView
android:id="#+id/judul_seo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/kordinat_lokasi"
android:visibility="gone" />
<TextView
android:id="#+id/status_gambar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/judul_seo"
android:visibility="gone" />
<TextView
android:id="#+id/gambar_tulisan_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/status_gambar"
android:visibility="gone" />
<ImageView
android:id="#+id/gambar_tulisan"
android:layout_width="96dp"
android:layout_height="96dp"
android:layout_alignParentLeft="true"
android:layout_below="#+id/judul"
android:layout_gravity="top"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="6dp"
android:background="#drawable/image_bg"
android:contentDescription="#string/gambar_tulisan"
android:cropToPadding="true"
android:scaleType="centerCrop"
android:src="#drawable/detail_droidersuin" />
<TextView
android:id="#+id/sekilas_isi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/gambar_tulisan"
android:layout_alignTop="#+id/gambar_tulisan"
android:layout_below="#+id/judul"
android:layout_toRightOf="#+id/gambar_tulisan"
android:textColor="#555555"
android:textSize="14sp" />
</RelativeLayout>
<LinearLayout
android:id="#+id/CommentLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:paddingBottom="4dp" >
<TextView
android:id="#+id/dibaca"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:paddingTop="4dp"
android:textColor="#555555"
android:textSize="12sp"
android:textStyle="italic"
android:typeface="sans" />
<ImageView
android:id="#+id/reader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="4dp"
android:contentDescription="#string/reader"
android:src="#drawable/reader" />
<TextView
android:id="#+id/jmlh_komentar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:textColor="#555555"
android:textSize="12sp"
android:textStyle="italic"
android:typeface="sans" />
<ImageView
android:id="#+id/ic_komentar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:contentDescription="#string/ic_komentar"
android:src="#drawable/comment" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:id="#+id/action_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/isi_layout"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:clickable="false" >
<ImageButton
android:id="#+id/favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="#drawable/button_action_indicator"
android:contentDescription="#string/button_favorite"
android:src="#drawable/favorite_noactive" />
<ImageButton
android:id="#+id/share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="8dp"
android:layout_toRightOf="#+id/comment"
android:background="#drawable/button_action_indicator"
android:contentDescription="#string/button_share"
android:src="#drawable/share" />
<ImageButton
android:id="#+id/comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="8dp"
android:layout_toRightOf="#+id/favorite"
android:background="#drawable/button_action_indicator"
android:contentDescription="#string/button_comment"
android:src="#drawable/komentar" />
</RelativeLayout>
</RelativeLayout>
the problem is here , the linearlayout not fill height , but width no problem ,
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:layout_margin="4dp"
android:background="#drawable/inbox_interface" >
if it is run on the phone, even like this
the view just looks line black line
but I want to look like this
sorry for my english
While inside the code (or the adapter), you could try this, get the height of the screen and set the minimumHeight of the linear layout or relative layout to the height that you obtain.
to get the height of the screen follow this
I have a listview with two textviews in a row like name and result. I want to fit the textview to the row because I need to set a background color to the second textview.I have tried "match_parent"fill_parent"..etc
//items.xml
<ImageView
android:id="#+id/imgViewLogo"
android:layout_width="22dip"
android:layout_height="22dip"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:scaleType="center"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/txtViewTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/txtViewDescription"
android:layout_alignBottom="#+id/txtViewDescription"
android:layout_marginLeft="6dp"
android:layout_toRightOf="#+id/imgViewLogo"
android:text="TextView"
android:textStyle="bold" />
<MyTextView
android:id="#+id/txtViewDescription"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/imgViewLogo"
android:layout_marginRight="33dp"
android:layout_gravity="center"
android:text="TextView"
android:textStyle="bold" />
<ImageView
android:id="#+id/temperrr"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:src="#drawable/resultarrawnocolor" />
</RelativeLayout>
// listview.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="#+id/gl1"
style="?android:attr/buttonStyleSmall"
android:layout_width="64dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#drawable/back"
android:gravity="center_vertical"
android:onClick="backMan" />
<TextView
android:id="#+id/textVie3"
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_alignParentLeft="true"
android:layout_below="#+id/gl1"
android:background="#drawable/header_line" />
<Button
android:id="#+id/gl2"
style="?android:attr/buttonStyleSmall"
android:layout_width="64dp"
android:layout_height="40dp"
android:layout_above="#+id/textVie3"
android:layout_alignParentRight="true"
android:background="#drawable/info"
android:gravity="center_vertical"
android:onClick="info" />
<TextView
android:id="#+id/textVie1"
android:layout_width="135dp"
android:layout_height="30dp"
android:layout_alignBaseline="#+id/gl2"
android:layout_alignBottom="#+id/gl2"
android:layout_centerHorizontal="true"
android:background="#drawable/uchek_header"
android:gravity="center" />
<TextView
android:id="#+id/bgnf1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textVie3"
android:background="#drawable/main_bag" />
<TextView
android:id="#+id/myTextView1"
android:layout_width="375dp"
android:layout_height="35dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/bgnf1"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#drawable/textviewtableheader"
android:gravity="center_vertical"
android:paddingLeft="10dp"
android:text="Result"
android:textColor="#FFFFFF"
android:textSize="20sp"
android:textStyle="bold" />
<Button
android:id="#+id/btnemail"
android:layout_width="60dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#drawable/email"/>
<Button
android:id="#+id/btnsave"
android:layout_width="60dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="#drawable/save"
/>
<Button
android:id="#+id/btnrec"
android:layout_width="60dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignRight="#+id/myTextView1"
android:background="#drawable/rec"
/>
<ListView
android:id="#+id/lv1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/btnemail"
android:layout_alignLeft="#+id/myTextView1"
android:layout_alignRight="#+id/myTextView1"
android:layout_below="#+id/myTextView1"
android:background="#color/White"
android:divider="#drawable/tabledivider"
android:dividerHeight="1dp"
android:listSelector="#drawable/listcolor"
tools:listitem="#android:layout/simple_list_item_1" >
</ListView>
</RelativeLayout>
If you want the height to be of icon size you can use this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:weightSum="1" >
<TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight=".5"
android:background="#F00"
android:gravity="center_vertical"
android:text="Envelope" />
<TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight=".5"
android:background="#990"
android:gravity="center_vertical"
android:text="1000ml/Dl" />
</LinearLayout>
</LinearLayout>
Try distributing the weight of ImageView , TextView , TextView and ImageView to get the desired result.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/imgViewLogo"
android:layout_width="22dip"
android:layout_height="22dip"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:scaleType="center"
android:src="#drawable/ic_launcher" />
<LinearLayout
android:id="#+id/linear_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/temperrr"
android:layout_toRightOf="#+id/imgViewLogo"
android:orientation="horizontal"
android:weightSum="1.0" >
<TextView
android:id="#+id/txtViewTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/txtViewDescription"
android:layout_alignBottom="#+id/txtViewDescription"
android:layout_toRightOf="#+id/imgViewLogo"
android:layout_weight="0.5"
android:background="#ff0000"
android:text="TextView"
android:textStyle="bold" />
<TextView
android:id="#+id/txtViewDescription"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/imgViewLogo"
android:layout_gravity="center"
android:layout_weight="0.5"
android:background="#ffff00"
android:text="TextView"
android:textStyle="bold" />
</LinearLayout>
<ImageView
android:id="#+id/temperrr"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:src="#drawable/ic_launcher" />
</RelativeLayout>
may be this will help, i edited the answer,check now