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>
Related
Running the below code in ANDROID studio is not giving me the desired result: Please help? I would like the 3 TextViews to be equally spaced out vertically in the screen of the device.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Debanshu"
android:textSize="24sp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="Chakraborty"
android:textSize="24sp"
android:layout_weight="1" />
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="Voltas"
android:textSize="24sp"
android:layout_weight="1"/>
</LinearLayout>
I believe you want this (added gravity just for the fun of it):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Debanshu"
android:gravity="center"
android:textSize="24sp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="Chakraborty"
android:textSize="24sp"
android:gravity="center"
android:layout_weight="1" />
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="Voltas"
android:textSize="24sp"
android:gravity="center"
android:layout_weight="1"/>
</LinearLayout>
As you LinearLayout height equal to wrap_content its working but as height wrapping view you are not getting desired view
try below making LinearLayout height equal to match_parent
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Debanshu"
android:textSize="24sp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="Chakraborty"
android:textSize="24sp"
android:layout_weight="1" />
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="Voltas"
android:textSize="24sp"
android:layout_weight="1"/>
</LinearLayout>
you can try this its work for me
<?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="wrap_content"
android:layout_weight="1"
android:text="Debanshu"
android:background="#ffa905"
android:textSize="24sp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Chakraborty"
android:textSize="24sp"
android:background="#ffffff"
android:layout_weight="1" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Voltas"
android:textSize="24sp"
android:background="#008000"
android:layout_weight="1"/>
enjoy!!!
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"/>
Friends,
I am new to android so I could use your help. I want to implement a gallery where the user can flip between two images (presented in ImageView1 below). The display that I want is given by:
[TextView1] [TextView2]
[ImageView1]
[ImageView2]
Where [TextView1] and [TextView2] are static texts that do not change with flipping between the two images. [ImageView1] is the actual image that is displayed and [ImageView2] is an image indicator (i.e., image one is selected).
I am using ViewPager to bound the images to [ImageView1], which is given below:
<?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:paddingLeft="10dp"
android:paddingRight="10dp" >
<ImageView
android:id="#+id/image_to_show"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="0dp"
android:contentDescription="#string/image_description"
android:scaleType="fitCenter" />
</RelativeLayout>
The main fragment where the images are shown:
<?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" >
<TextView
android:id="#+id/name_of_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:textColor="#color/card_text_color"
android:textSize="14sp" />
<TextView
android:id="#+id/date_taken"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:paddingBottom="10dp"
android:textColor="#color/card_text_color"
android:textSize="14sp" />
<android.support.v4.view.ViewPager
android:id="#+id/details_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingTop="10dp" />
<LinearLayout
android:id="#+id/page_indicator_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal"/>
</RelativeLayout>
The output from the code is:
[TextView1] [TextView2]
[ImageView2]
[ImageView1]
Where the image and page indicator have reversed positions.
Any ideas how I can fix this?
I do not want any vertical space among the views. I have used a LinearLayout instead of the RelativeLayout for the main fragment, but that leaves space among the views depending on the screen size.
Try this way,hope this will help you to solve your problem.
<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="wrap_content">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="#+id/name_of_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/card_text_color"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="#+id/date_taken"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/card_text_color"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<android.support.v4.view.ViewPager
android:id="#+id/details_image"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:paddingBottom="10dp"
android:paddingTop="10dp" />
<LinearLayout
android:id="#+id/page_indicator_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal"/>
</LinearLayout>
Do 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" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="TextView1" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="TextView1" />
</LinearLayout>
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
Change your code with this
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>