I am trying to have two text and an arrow mark to the end. So I tried the following:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:layout_weight="0.25"
android:gravity="center_vertical">
<TextView
android:id="#+id/labeltext"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="Specification"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="right"
android:src="#drawable/ic_next"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/labelselected"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Specification down"/>
</LinearLayout>
</LinearLayout>
But I am still getting :
I thought if we put android:gravity="right" the whole image goes to the right but this didn't move?
Can somebody help me out with this?
NOTE :
first put LinearLayoutwith horizontal orientation
then put another 2 LinearLayoutinside it and set the layout_weight as your desire
then add anything that you want inside them.
thats all....
here is the corrected code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="4"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_vertical"
android:layout_weight="3">
<TextView
android:id="#+id/labeltext"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="Specification" />
<TextView
android:id="#+id/labelselected"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Specification down"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="1"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="right"
android:src="#android:drawable/sym_def_app_icon"/>
</LinearLayout>
</LinearLayout>
You can do this way.
Screenshot reference:
I did it by set match_parent width to TextView and assigning drawableRight property.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/labeltext"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawableRight="#drawable/ic_next"
android:gravity="center_vertical"
android:text="Specification" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/labelselected"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Specification down" />
</LinearLayout>
</LinearLayout>
Hope this will help you.
Instead of using an ImageView you can set your icon as a drawable to your TextView and set its width to match_parent
<TextView
...
android:drawableRight="#drawable/your_icon"/>
also I think your IDE will suggest you to remove your LinearLayout , TextView and ImageView and use my solution because using one widget instead of three is always better ;)
Change your layout and try. I am just giving hint. to place text and image in same line with distributed layout_weight. You can tweak as per your need
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical">
<TextView
android:id="#+id/labeltext"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:text="Specification"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:src="#drawable/ic_next"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/labelselected"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Specification down"/>
</LinearLayout>
</LinearLayout>
Replace this with your Upper Layout. you need to use layout_gravity="right" for imageView.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical">
<TextView
android:id="#+id/labeltext"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="left|center"
android:text="Specification"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="right"
android:layout_gravity="right"
android:src="#drawable/ic_next"/>
</LinearLayout>
Use this it will work for you.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/labeltext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Specification" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="#drawable/ic_next" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/labelselected"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Specification down" />
</LinearLayout>
</LinearLayout>
Use FrameLayout instead of LinearLayout like here:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"
android:gravity="center_vertical">
<TextView
android:id="#+id/labeltext"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="Specification"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="right"
android:src="#drawable/ic_next"
android:layout_gravity="right|center_vertical"/>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/labelselected"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Specification down"/>
</LinearLayout>
Just add weight to lateltext textView as 1
<TextView
android:id="#+id/labeltext"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:text="Specification"
android:layout_weight="1"/>
Related
I want the ImageView keep its aspect ratio with layout_height=match_parent
but I don't know why this happen ?
<?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">
<LinearLayout
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:background="#drawable/bob" />
<TextView
android:gravity="center"
android:textAppearance="#style/TextAppearance.AppCompat.Headline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bob" />
</LinearLayout>
</LinearLayout>
<?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">
<LinearLayout
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#drawable/bob" />
<TextView
android:gravity="center"
android:textAppearance="#style/TextAppearance.AppCompat.Headline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bob" />
</LinearLayout>
</LinearLayout>
Use for this to set in full image view scaletype=fitxy
My activity has 3 elements. Linearlayout, Gridview and the Linearlayout. See picture. How to make Gridview items is completely visible even if there is a scroll on all screens? p.s. Sorry for my English.
Well use this code for such a layout design...
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/layoutTopLay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/btn_br_color"
android:gravity="center"
android:layout_alignParentTop="true"
android:padding="3dp">
<TextView
android:id="#+id/primiumGameNameText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="4"
android:text="Layout1"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<GridView
android:id="#+id/gridViewID"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
android:layout_below="#+id/layoutTopLay"
android:layout_above="#+id/layoutBottomLay"
android:paddingRight="5dp"
android:paddingTop="3dp" />
<LinearLayout
android:id="#+id/layoutBottomLay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/btn_br_color"
android:gravity="center"
android:layout_alignParentBottom="true"
android:padding="3dp">
<TextView
android:id="#+id/layoutBottomText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="fill"
android:gravity="center"
android:maxLines="24"
android:text="Layout2"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
Another way how to do it is to use layout_weight attribute:
<?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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#android:color/holo_blue_dark"
/>
<GridLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="8"
android:background="#android:color/white"
>
<!-- put content here -->
</GridLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#android:color/holo_blue_dark"
/>
</LinearLayout>
I have RelativeLayout inside SrcollView. That ScrollView will be an child of LinearLayout. In RelativeLayout I added views programmatically. But ScrollView is not scrolling.
startActivityCenterLayout - place between AutocompleteTextView's container and Button's container.
How I can resolve it?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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:id="#+id/startActivityRootLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="10dp"
android:background="#color/dark_cyan"
tools:context="com.geodevteam.geopay.project.activity.StartActivity">
<LinearLayout
android:orientation="vertical"
android:id="#+id/startActivityTopLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#color/dark_cyan">
<ImageView
android:id="#+id/startActivityLogoImageView"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:src="#mipmap/ico"/>
<TextView
android:id="#+id/startActivityLogoTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
style="#style/ApplicationNameTextView"
android:text="#string/application_title"/>
<AutoCompleteTextView
android:id="#+id/startActivityAutocompleteTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="25dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
style="#style/AutocompleteTextViewTextColor"
android:hint="#string/start_to_input_name"/>
</LinearLayout>
<LinearLayout
android:id="#+id/startActivityCenterLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/startActivityTopLayout"
android:paddingBottom="10dp"
android:background="#color/dark_cyan">
<ScrollView
android:id="#+id/startActivityCenterLayoutScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:id="#+id/cardsRootLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
</ScrollView>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:id="#+id/startActivityBottomLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/dark_cyan">
<Button
android:id="#+id/startActivitySocialsButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/login_by_mail_button"
style="#style/LoginByMailButton"
android:text="#string/login_sign_using_social" />
<Button
android:id="#+id/startActivityEmailButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/login_by_mail_button"
style="#style/LoginByMailButton"
android:text="#string/login_using_mail" />
</LinearLayout>
</RelativeLayout>
The layout is scrollable if necessary, so if you didn't put anything inside the Relative Layout, you aren't able to scroll.
This is Because hight of your ScrollView is 0dp. And Regarding that weight you have given to ScrollViewis work only if you have given weightSum to parent LinearLayout.
Eighter you give weightSum to LinrearLayout or Change Hight of ScrollView to match_parent.
Happy Coding.
Now scrollview is working. Code down below
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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:id="#+id/startActivityRootLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="10dp"
android:background="#color/dark_cyan"
tools:context="com.geodevteam.geopay.project.activity.StartActivity">
<LinearLayout
android:orientation="vertical"
android:id="#+id/startActivityTopLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#color/dark_cyan">
<ImageView
android:id="#+id/startActivityLogoImageView"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:src="#mipmap/ico"/>
<TextView
android:id="#+id/startActivityLogoTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
style="#style/ApplicationNameTextView"
android:text="#string/application_title"/>
<AutoCompleteTextView
android:id="#+id/startActivityAutocompleteTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="25dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
style="#style/AutocompleteTextViewTextColor"
android:hint="#string/start_to_input_name"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:id="#+id/startActivityBottomLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_alignParentBottom="true"
android:background="#color/dark_cyan">
<Button
android:id="#+id/startActivitySocialsButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/login_by_mail_button"
style="#style/LoginByMailButton"
android:text="#string/login_sign_using_social" />
<Button
android:id="#+id/startActivityEmailButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/login_by_mail_button"
style="#style/LoginByMailButton"
android:text="#string/login_using_mail" />
</LinearLayout>
<LinearLayout
android:id="#+id/startActivityCenterLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#id/startActivityBottomLayout"
android:layout_below="#id/startActivityTopLayout"
android:background="#color/dark_cyan">
<ScrollView
android:id="#+id/startActivityCenterLayoutScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:id="#+id/cardsRootLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
</ScrollView>
</LinearLayout>
</RelativeLayout>
How can I make this layout:
This is my xml code so far:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="#+id/exampleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Push the button"
android:background="#ffff00"
android:textColor="#000000"
android:textStyle="bold"
android:paddingLeft="5dip"
android:paddingRight="5dip"
android:layout_weight="1"/>
<Button
android:id="#+id/exampleButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="The button"
android:layout_weight="1"/>
</LinearLayout>
You made me laugh with your drawing thanks:) BTW you can do that with a textView and a button like below:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:drawableLeft="#drawable/ic_launcher"
android:text="dummy text 1 \n dummy text 2"
android:gravity="center"/>
<Button
android:id="#+id/dummyButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="dummy" />
</LinearLayout>
Or something more complex:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal" >
<ImageView
android:id="#+id/dummyImageView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#58FA58"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="#+id/myDummyTextView1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#DF013A" />
<TextView
android:id="#+id/myDummyTextView2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#2EFEF7" />
</LinearLayout>
</LinearLayout>
<Button
android:id="#+id/dummyButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="dummy"/>
</LinearLayout>
Or more efficient with relativeLayout. That will be another issue, read more about it. But I'd prefer first one if it is enough for you.
I have a framelayout with id listLayout that contains the button. I want it to be just above the other framelayout with id news_fragment but it is coming besides this.
Here is the xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="#+id/listLayout"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content">
<Button
android:id="#+id/lists"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/btn_black_xml"
android:padding="8dp"
android:text="List"
android:textColor="#ffffff"
android:textSize="20dp" />
</FrameLayout>
<FrameLayout
android:id="#+id/news_fragment"
android:layout_weight="2"
android:layout_width="0dp"
android:layout_height="match_parent">
</FrameLayout>
<FrameLayout
android:id="#+id/channel_fragment"
android:layout_weight="3"
android:layout_width="0dp"
android:layout_height="match_parent" />
</LinearLayout>
You LinearLayout is horizontal, that why child views are shown besides each other. try to put it vertical instead :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
...
I hope I understand well you question.
also be aware that you should simplify your layout : having one single view inside some layouts is useless and resource consuming :
in other word :
<FrameLayout
android:id="#+id/listLayout"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content">
<Button
android:id="#+id/lists"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/btn_black_xml"
android:padding="8dp"
android:text="List"
android:textColor="#ffffff"
android:textSize="20dp" />
</FrameLayout>
is bad, the FrameLayout is useless.
Take a look if it is what are looking for:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout
android:id="#+id/listLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<Button
android:id="#+id/lists"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="8dp"
android:text="List"
android:textColor="#ffffff"
android:textSize="20dp" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="fill_parent" >
<FrameLayout
android:id="#+id/news_fragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
</FrameLayout>
<FrameLayout
android:id="#+id/channel_fragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
</FrameLayout>
</LinearLayout>
</LinearLayout>
Put them both in Linearlayout vertical like so
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:id="#+id/listLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="#+id/lists"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/btn_black_xml"
android:padding="8dp"
android:text="List"
android:textColor="#ffffff"
android:textSize="20dp" />
</FrameLayout>
<FrameLayout
android:id="#+id/news_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2" >
</FrameLayout>
</LinearLayout>
<FrameLayout
android:id="#+id/channel_fragment"
android:layout_weight="3"
android:layout_width="0dp"
android:layout_height="match_parent" />
</LinearLayout>