I'm trying to align a number of buttons under a list of items.
It's appearing as follows:
But I need it to appear as follows:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="7dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/myImage" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="[TextView text]"
android:textSize="20sp"
android:layout_gravity="center" />
</LinearLayout>
<TextView
android:id="#+id/lblOverviewText"
android:textStyle="bold"
android:textSize="15sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout1" />
<TextView
android:id="#+id/lblEngineer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/lblOverviewText" />
<TextView
android:id="#+id/lblAlarmEvents"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/lblEngineer" />
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/lblAlarmEvents" />
<LinearLayout
android:id="#+id/linearLayoutSetUnsetButtons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="#+id/list">
<ImageButton
android:id="#+id/btnFullSet"
android:background="#null"
android:layout_width="50dp"
android:layout_height="50dp"
android:text="Full Set"
android:layout_margin="5dp"
android:src="#drawable/lock_128"
android:scaleType="fitCenter" />
<ImageButton
android:id="#+id/btnPartsetA"
android:background="#null"
android:layout_width="50dp"
android:layout_height="50dp"
android:text="Part A"
android:layout_alignParentTop="true"
android:layout_margin="5dp"
android:src="#drawable/PartSetA_128"
android:scaleType="fitCenter" />
<ImageButton
android:id="#+id/btnPartsetB"
android:background="#null"
android:layout_width="50dp"
android:layout_height="50dp"
android:text="Part B"
android:layout_alignParentTop="true"
android:layout_margin="5dp"
android:src="#drawable/PartSetB_128"
android:scaleType="fitCenter" />
<ImageButton
android:id="#+id/btnUnset"
android:background="#null"
android:layout_width="50dp"
android:layout_height="50dp"
android:text="Unset"
android:layout_alignParentTop="true"
android:layout_margin="5dp"
android:src="#drawable/Unset_128"
android:scaleType="fitCenter"
android:visibility="gone" />
</LinearLayout>
</RelativeLayout>
Try this way
Make your listview wrap_content
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/lblAlarmEvents" />
<LinearLayout
android:id="#+id/linearLayoutSetUnsetButtons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:layout_alignParentBottom="true"
android:layout_below="#+id/list">
XML file will be like this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="7dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/myImage" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="[TextView text]"
android:textSize="20sp"
android:layout_gravity="center" />
</LinearLayout>
<TextView
android:id="#+id/lblOverviewText"
android:textStyle="bold"
android:textSize="15sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout1" />
<TextView
android:id="#+id/lblEngineer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/lblOverviewText" />
<TextView
android:id="#+id/lblAlarmEvents"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/lblEngineer" />
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/lblAlarmEvents" />
<LinearLayout
android:id="#+id/linearLayoutSetUnsetButtons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="#+id/list">
<ImageButton
android:id="#+id/btnFullSet"
android:background="#null"
android:layout_width="50dp"
android:layout_height="50dp"
android:text="Full Set"
android:layout_margin="5dp"
android:src="#drawable/lock_128"
android:scaleType="fitCenter" />
<ImageButton
android:id="#+id/btnPartsetA"
android:background="#null"
android:layout_width="50dp"
android:layout_height="50dp"
android:text="Part A"
android:layout_alignParentTop="true"
android:layout_margin="5dp"
android:src="#drawable/PartSetA_128"
android:scaleType="fitCenter" />
<ImageButton
android:id="#+id/btnPartsetB"
android:background="#null"
android:layout_width="50dp"
android:layout_height="50dp"
android:text="Part B"
android:layout_alignParentTop="true"
android:layout_margin="5dp"
android:src="#drawable/PartSetB_128"
android:scaleType="fitCenter" />
<ImageButton
android:id="#+id/btnUnset"
android:background="#null"
android:layout_width="50dp"
android:layout_height="50dp"
android:text="Unset"
android:layout_alignParentTop="true"
android:layout_margin="5dp"
android:src="#drawable/Unset_128"
android:scaleType="fitCenter"
android:visibility="gone" />
</LinearLayout>
Or If you want your image button's parent layout as a footer set the xml like this:
XML file will be like this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="7dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/myImage" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="[TextView text]"
android:textSize="20sp"
android:layout_gravity="center" />
</LinearLayout>
<TextView
android:id="#+id/lblOverviewText"
android:textStyle="bold"
android:textSize="15sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout1" />
<TextView
android:id="#+id/lblEngineer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/lblOverviewText" />
<TextView
android:id="#+id/lblAlarmEvents"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/lblEngineer" />
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/lblAlarmEvents" />
<LinearLayout
android:id="#+id/linearLayoutSetUnsetButtons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true">
<ImageButton
android:id="#+id/btnFullSet"
android:background="#null"
android:layout_width="50dp"
android:layout_height="50dp"
android:text="Full Set"
android:layout_margin="5dp"
android:src="#drawable/lock_128"
android:scaleType="fitCenter" />
<ImageButton
android:id="#+id/btnPartsetA"
android:background="#null"
android:layout_width="50dp"
android:layout_height="50dp"
android:text="Part A"
android:layout_alignParentTop="true"
android:layout_margin="5dp"
android:src="#drawable/PartSetA_128"
android:scaleType="fitCenter" />
<ImageButton
android:id="#+id/btnPartsetB"
android:background="#null"
android:layout_width="50dp"
android:layout_height="50dp"
android:text="Part B"
android:layout_alignParentTop="true"
android:layout_margin="5dp"
android:src="#drawable/PartSetB_128"
android:scaleType="fitCenter" />
<ImageButton
android:id="#+id/btnUnset"
android:background="#null"
android:layout_width="50dp"
android:layout_height="50dp"
android:text="Unset"
android:layout_alignParentTop="true"
android:layout_margin="5dp"
android:src="#drawable/Unset_128"
android:scaleType="fitCenter"
android:visibility="gone" />
</LinearLayout>
Related
I am working on a basic audio view for an android app (xamarin.android), i want to achieve the following result:
But instead i am getting this ugly result (ignore the other anomalies, focus on the layout):
The bottom relativeLayout (the one that holds the buttons) seems t get more space that actually needed, when i set the top RelativeLayout (the image holder) to match_parent the bottom RelativeLayout disappeared entirely even tho its high is set to wrap_content.
Here is my view's layout, what i am doing wrong?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:fitsSystemWindows="true"
android:id="#+id/top_parent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
layout="#layout/Toolbar"
android:id="#+id/toolbar_content" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white"
android:layout_below="#id/toolbar_content"
android:id="#+id/gridLayout1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/black"
android:id="#+id/cover_layout"
android:layout_marginBottom="0.0dp">
<ImageView
android:layout_width="500dp"
android:layout_height="400dp"
android:id="#+id/imageview_cover"
android:background="#color/gray"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true" />
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/linearLayout1"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true">
<TextView
android:id="#+id/textview_title"
android:gravity="left"
android:textColor="#color/white"
android:textStyle="bold"
android:text="Audio Book Title"
android:textSize="#dimen/text_very_huge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
<TextView
android:id="#+id/textview_author"
android:gravity="left"
android:textColor="#color/colorAccent"
android:text="Author"
android:textSize="#dimen/text_small"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/cover_layout"
android:id="#+id/relativeLayout2"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:background="#color/white"
android:layout_marginTop="0.0dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/relativeLayout3"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true"
android:layout_marginTop="#dimen/element_margin_tiny"
android:layout_marginBottom="#dimen/element_margin_tiny">
<TextView
android:text="Position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textview_position"
android:gravity="center"
android:layout_marginLeft="#dimen/element_margin_large"
android:textColor="#color/black"
android:layout_centerVertical="true" />
<SeekBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/textview_position"
android:id="#+id/player_seekbar"
android:layout_toLeftOf="#+id/textview_duration"
android:clickable="true"
style="#style/GreenSeekBar"
android:layout_centerVertical="true" />
<TextView
android:text="Duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textview_duration"
android:layout_alignParentRight="true"
android:layout_alignBottom="#+id/seekBar1"
android:layout_alignTop="#+id/seekBar1"
android:gravity="center"
android:layout_marginRight="#dimen/element_margin_large"
android:textColor="#color/black"
android:layout_centerVertical="true" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:id="#+id/relativeLayout5"
android:layout_below="#id/relativeLayout3"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<ToggleButton
android:src="#drawable/toggle_sound"
android:id="#+id/btnSound"
android:layout_width="30dp"
android:layout_height="30dp"
android:textOff=" "
android:textOn=" "
android:layout_weight="2"
android:scaleType="center"
android:paddingLeft="#dimen/element_margin_tiny" />
<ImageButton
android:layout_width="40dp"
android:layout_height="40dp"
android:id="#+id/btnPrevious"
android:background="#null"
android:src="#drawable/button_previous"
android:scaleType="center"
android:layout_toRightOf="#+id/btnSound"
android:layout_weight="2" />
<ToggleButton
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/btnPlayPause"
android:src="#drawable/togglebutton_playpause"
android:layout_centerVertical="true"
android:scaleType="center"
android:textOff=" "
android:textOn=" "
android:layout_toRightOf="#+id/btnPrevious"
android:layout_toLeftOf="#+id/btnNext"
android:layout_weight="2" />
<ImageButton
android:layout_width="40dp"
android:layout_height="40dp"
android:id="#+id/btnNext"
android:background="#null"
android:src="#drawable/button_next"
android:scaleType="center"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/btnRepeat"
android:layout_weight="2" />
<ToggleButton
android:src="#drawable/toggle_playlist"
android:id="#+id/btnRepeat"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerVertical="true"
android:textOff=" "
android:textOn=" "
android:scaleType="center"
android:layout_weight="2" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
you need to decrease your imageView size. And also you need to change your main layout to LinearLayout. Try below solution and it will work for you.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/gridLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="#+id/cover_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/relativeLayout2"
android:layout_alignParentTop="true"
android:layout_marginBottom="0.0dp" >
<ImageView
android:id="#+id/imageview_cover"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="#color/gray" />
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:orientation="vertical">
<TextView
android:id="#+id/textview_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:singleLine="true"
android:text="Audio Book Title"
android:textColor="#color/white"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textview_author"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:singleLine="true"
android:text="Author"
android:textColor="#color/colorAccent"
android:textSize="12sp" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeLayout2"
android:layout_width="match_parent"
android:layout_height="80dp"
android:gravity="center"
android:layout_alignParentBottom="true">
<RelativeLayout
android:id="#+id/relativeLayout3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/relativeLayout5"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="#dimen/element_margin_tiny"
android:layout_marginTop="#dimen/element_margin_tiny">
<TextView
android:id="#+id/textview_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="#dimen/element_margin_large"
android:layout_marginLeft="#dimen/element_margin_large"
android:gravity="center"
android:text="Position"
android:textColor="#color/black" />
<SeekBar
android:id="#+id/player_seekbar"
style="#style/GreenSeekBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/textview_duration"
android:layout_toRightOf="#+id/textview_position"
android:clickable="true" />
<TextView
android:id="#+id/textview_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="#dimen/element_margin_large"
android:gravity="center"
android:text="Duration"
android:textColor="#color/black" />
</RelativeLayout>
<LinearLayout
android:id="#+id/relativeLayout5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<ToggleButton
android:id="#+id/btnSound"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_weight="2"
android:paddingLeft="#dimen/element_margin_tiny"
android:scaleType="center"
android:src="#drawable/toggle_sound"
android:textOff=" "
android:textOn=" " />
<ImageButton
android:id="#+id/btnPrevious"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_weight="2"
android:background="#null"
android:scaleType="center"
android:src="#drawable/button_previous" />
<ToggleButton
android:id="#+id/btnPlayPause"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_weight="2"
android:scaleType="center"
android:src="#drawable/togglebutton_playpause"
android:textOff=" "
android:textOn=" " />
<ImageButton
android:id="#+id/btnNext"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/btnRepeat"
android:layout_weight="2"
android:background="#null"
android:scaleType="center"
android:src="#drawable/button_next" />
<ToggleButton
android:id="#+id/btnRepeat"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerVertical="true"
android:layout_weight="2"
android:scaleType="center"
android:src="#drawable/toggle_playlist"
android:textOff=" "
android:textOn=" " />
</LinearLayout>
</RelativeLayout>
I tried do something like this:
And problem is with icon that go out from dialog bounds.Im understood that I can make one RelativeLayout for all screen,and inner for this dialog,in bigger I must put my icon and try to make them in the head of dialog.Correct?
I tried this but what I have is my icon was like a background of dialog,not at dialog.Like this:
what can I do to change that?
my layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/rlimageforimage"
android:layout_centerHorizontal="true"
>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="#+id/dialog_icon"
android:src="#drawable/emilypic"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/outsideCimage"
android:src="#drawable/cicon"
android:layout_alignTop="#id/dialog_icon"
android:layout_alignBottom="#id/dialog_icon"
android:layout_alignLeft="#id/dialog_icon"
android:layout_alignRight="#id/dialog_icon"
android:scaleType="fitXY"
/>
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/rounded_corners"
android:layout_marginTop="70dp"
>
<Button
android:layout_width="40dp"
android:layout_height="40dp"
android:background="#drawable/ic_clear_black_18dp"
android:id="#+id/close_button"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/LLTitleandNick"
android:layout_below="#id/rlimageforimage"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/dialog_title"
android:textSize="22sp"
android:textColor="#color/title_color"
android:text="Lily Martinson"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/dialog_nickname"
android:textSize="18sp"
android:text="lilmartini"
android:layout_marginLeft="35dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="#id/LLTitleandNick"
android:layout_marginTop="40dp"
android:layout_marginLeft="26dp"
android:id="#+id/LLFollowers"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image_like"
android:layout_marginLeft="30dp"
android:src="#drawable/ic_favorite_border_black_18dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/Followers"
android:text="Followers"
/>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image_follow"
android:layout_marginLeft="45dp"
android:src="#drawable/ic_directions_walk_black_18dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Following"
/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/darker_gray"
android:layout_below="#id/LLFollowers"
android:layout_marginTop="50dp"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/LLwithButtons"
android:layout_below="#+id/LLFollowers"
android:layout_marginTop="70dp"
>
<Button
android:layout_width="55dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:background="#drawable/ic_question_answer_black_18dp"
android:layout_marginLeft="20dp"
/>
<Button
android:layout_width="55dp"
android:layout_height="50dp"
android:background="#drawable/cicon"
android:layout_centerInParent="true"
/>
<Button
android:layout_width="55dp"
android:layout_height="50dp"
android:background="#drawable/ic_person_add_black_18dp"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
/>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
This is what I'm trying to achieve:
I'm trying to add an ImageView (cirlce avatar) which is aligned to the bottom right of the top bar but with an overlay extending below the bar.
Here's what I have so far:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="45dp"
android:background="#ff652c90">
<ImageButton
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/backBtn"
android:src="#drawable/backarrow"
android:background="#android:color/transparent"
android:paddingLeft="10dp"
android:layout_centerVertical="true"
android:scaleType="fitCenter"
android:layout_gravity="center_vertical" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/backBtn"
android:id="#+id/infoLayout"
android:layout_centerVertical="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Lesky"
android:id="#+id/contactName"
android:textColor="#ffffffff"
android:paddingLeft="10dp"
android:textSize="16dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="last online 22/4/2016 11:36 am"
android:id="#+id/lastSeen"
android:layout_below="#id/contactName"
android:textColor="#ffd1d2d4"
android:paddingLeft="10dp"
android:textSize="10dp" />
</RelativeLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:id="#+id/imageView"
android:src="#drawable/contactpiccirlce"
android:scaleType="fitCenter" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/chatView"
android:layout_gravity="center_horizontal" />
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="#android:color/black"
android:layout_alignBottom="#id/chatView"
android:id="#+id/postArea">
<EditText
android:layout_width="wrap_content"
android:layout_height="30dp"
android:inputType="textMultiLine"
android:minHeight="30dp"
android:ems="10"
android:id="#+id/editText" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
How can anyone achieve this?
Replace with 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" >
<RelativeLayout
android:id="#+id/firstLayout"
android:layout_width="match_parent"
android:layout_height="45dp"
android:background="#ff652c90" >
<ImageButton
android:id="#+id/backBtn"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:paddingLeft="10dp"
android:scaleType="fitCenter"
android:src="#drawable/backarrow" />
<RelativeLayout
android:id="#+id/infoLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#id/backBtn" >
<TextView
android:id="#+id/contactName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="Lesky"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#ffffffff"
android:textSize="16dp" />
<TextView
android:id="#+id/lastSeen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/contactName"
android:paddingLeft="10dp"
android:text="last online 22/4/2016 11:36 am"
android:textColor="#ffd1d2d4"
android:textSize="10dp" />
</RelativeLayout>
</RelativeLayout>
<ImageView
android:id="#+id/imageView"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_alignParentRight="true"
android:layout_marginRight="5dp"
android:layout_marginTop="35dp"
android:scaleType="fitCenter"
android:src="#drawable/contactpiccirlce" />
<RelativeLayout
android:id="#+id/secondLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/firstLayout" >
<ListView
android:id="#+id/chatView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
<LinearLayout
android:id="#+id/postArea"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_alignBottom="#id/chatView"
android:background="#android:color/black"
android:orientation="vertical" >
<EditText
android:id="#+id/editText"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:ems="10"
android:inputType="textMultiLine"
android:minHeight="30dp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
How about this:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/infoLayout">
<ImageButton
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/backBtn"
android:src="#drawable/backarrow"
android:background="#android:color/transparent"
android:paddingLeft="10dp"
android:layout_centerVertical="true"
android:scaleType="fitCenter"
android:layout_gravity="center_vertical" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/backBtn"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Lesky"
android:id="#+id/contactName"
android:textColor="#ffffffff"
android:paddingLeft="10dp"
android:textSize="16dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/backBtn"
android:text="last online 22/4/2016 11:36 am"
android:id="#+id/lastSeen"
android:layout_below="#id/contactName"
android:textColor="#ffd1d2d4"
android:paddingLeft="10dp"
android:textSize="10dp" />
</RelativeLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#id/infoLayout"
android:layout_alignTop="#id/infoLayout"
android:padding="10dp"
android:scaleType="center"
android:id="#+id/imageView"
android:src="#drawable/contactpiccirlce"
android:scaleType="fitCenter" />
Hi I am new for android developer. I am using this library adding sliding menu to my application.
However how can i fire onlick listener? Please see my code below
Activitymain.xml
<?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="fill_parent">
<VideoView
android:scrollbars="none"
android:clickable="false"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:id="#+id/videoView"
android:layout_marginLeft="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:id="#+id/titleBar"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<FrameLayout
android:layout_width="50dp"
android:background="#9B1B32"
android:layout_height="50dp"
android:id="#+id/btnMenuFrame"
>
<Button
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/btnMenu"
android:layout_gravity="center"
android:background="#drawable/menu">
</Button>
</FrameLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:src="#drawable/logo" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/titleBar"
android:layout_margin="20dp"
android:gravity="center"
>
<ImageButton
android:id="#+id/imgBtnUserProfile"
android:layout_width="120dp"
android:layout_height="120dp"
android:src="#drawable/icon_1_b"
android:scaleType="fitCenter"
android:padding="20dp"
android:background="#android:color/transparent"
/>
<ImageButton
android:id="#+id/imgBtnTree"
android:layout_width="120dp"
android:layout_height="120dp"
android:src="#drawable/icon_2_b"
android:scaleType="fitCenter"
android:padding="20dp"
android:background="#android:color/transparent"
/>
<ImageButton
android:id="#+id/imgBtnManage"
android:layout_width="120dp"
android:layout_height="120dp"
android:src="#drawable/icon_3_b"
android:scaleType="fitCenter"
android:padding="20dp"
android:background="#android:color/transparent"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:layout_margin="30dp"
>
<TextView
android:id="#+id/lblCelcius"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:fontFamily="Arial"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF"
android:textSize="80sp"
android:textStyle="normal" />
<TextView
android:id="#+id/lblCity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="Arial"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF"
android:textSize="36sp"
android:textStyle="normal" />
<LinearLayout
android:id="#+id/wetherLinear"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<ImageView
android:id="#+id/imgWether"
android:layout_marginTop="20dp"
android:layout_width="50dp"
android:layout_height="50dp"
/>
<TextView
android:id="#+id/lblWetherMain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="30dp"
android:fontFamily="Arial"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF"
android:textSize="16sp"
android:textStyle="normal" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
SlidingMenu.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="250dp"
android:layout_height="match_parent"
android:id="#+id/slidemenu"
android:background="#f8f3ef">
<LinearLayout
android:id="#+id/titleBar"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:background="#9B1B32"
android:layout_height="wrap_content">
<FrameLayout
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/btnMenuFrame">
<Button
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/btnMenu"
android:layout_gravity="center"
android:background="#drawable/menu">
</Button>
</FrameLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/menu"
android:textColor="#FFFFFF"
android:layout_gravity="center"
android:textSize="18sp"
/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="50dp">
<TextView
android:id="#+id/lblLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/menu"
android:textColor="#9B1B32"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/RowUserProfile"
android:layout_below="#+id/titleBar"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_marginLeft="30dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:src="#drawable/logo" />
<LinearLayout
android:id="#+id/RowUserProfileDetail"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp">
<TextView
android:id="#+id/lblUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/etree"
android:textColor="#9B1B32"
android:layout_gravity="center" />
<TextView
android:id="#+id/lblUserEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/etree"
android:textColor="#9B1B32"
android:layout_gravity="center" />
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="fill_parent"
android:layout_height="1dp"
android:id="#+id/imageSeperator1"
android:layout_below="#+id/RowUserProfile"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:src="#drawable/line"
android:scaleType="fitXY" />
<LinearLayout
android:id="#+id/RowEtree"
android:layout_below="#+id/RowUserProfile"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_marginLeft="30dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:src="#drawable/icon_etree" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/etree"
android:textColor="#9B1B32"
android:layout_gravity="center" />
</LinearLayout>
<ImageView
android:layout_width="fill_parent"
android:layout_height="1dp"
android:id="#+id/imageSeperator3"
android:layout_below="#+id/RowEtree"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:src="#drawable/line"
android:scaleType="fitXY" />
<LinearLayout
android:id="#+id/RowRecruit"
android:layout_below="#+id/imageSeperator3"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_marginLeft="30dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:src="#drawable/icon_recruit" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/recruit"
android:textColor="#9B1B32"
android:layout_gravity="center" />
</LinearLayout>
<ImageView
android:layout_width="fill_parent"
android:layout_height="1dp"
android:id="#+id/imageSeperator4"
android:layout_below="#+id/RowRecruit"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:src="#drawable/line"
android:scaleType="fitXY" />
<LinearLayout
android:id="#+id/RowNetwork"
android:layout_below="#+id/imageSeperator4"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_marginLeft="30dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:src="#drawable/icon_network" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/network"
android:textColor="#9B1B32"
android:layout_gravity="center" />
</LinearLayout>
<ImageView
android:layout_width="fill_parent"
android:layout_height="1dp"
android:id="#+id/imageSeperator5"
android:layout_below="#+id/RowNetwork"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:src="#drawable/line"
android:scaleType="fitXY" />
<LinearLayout
android:id="#+id/RowReward"
android:layout_below="#+id/imageSeperator5"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_marginLeft="30dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:src="#drawable/icon_reward" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/reward"
android:textColor="#9B1B32"
android:layout_gravity="center" />
</LinearLayout>
<ImageView
android:layout_width="fill_parent"
android:layout_height="1dp"
android:id="#+id/imageSeperator6"
android:layout_below="#+id/RowReward"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:src="#drawable/line"
android:scaleType="fitXY" />
<LinearLayout
android:id="#+id/RowWallet"
android:layout_below="#+id/imageSeperator6"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_marginLeft="30dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:src="#drawable/icon_wallet" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/wallet"
android:textColor="#9B1B32"
android:layout_gravity="center" />
</LinearLayout>
<ImageView
android:layout_width="fill_parent"
android:layout_height="1dp"
android:id="#+id/imageSeperator7"
android:layout_below="#+id/RowReward"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:src="#drawable/line"
android:scaleType="fitXY" />
</RelativeLayout>
MainActivity.java
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.Activitymain);
// configure the SlidingMenu
final SlidingMenu menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidthRes(R.dimen.shadow_width);
menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
menu.setFadeDegree(0.35f);
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menu.setMenu(R.layout.slidemenu);
}
Any solution? If yes . Please provide me a simple example. Thanks
Check the example on the github repository. Handle item clicks in onOptionsItemSelected.
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