SlidingDrawer content stops at previous sibling view - android

I've got a view with a SlidingDrawer at the bottom. When I open it, it does not open entirely and stops at previous sibling view.
Anybody can help?
Thanks
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/home" android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<RelativeLayout android:id="#+id/top_bar"
android:layout_width="fill_parent" android:layout_height="44dp"
android:background="#drawable/top_bar">
<ImageView android:id="#+id/btn_popup"
android:layout_width="20dp" android:layout_height="20dp"
android:background="#456463" android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp" />
</RelativeLayout>
<LinearLayout android:id="#+id/featured"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="50dp" android:background="#drawable/bg_goodidea">
<TextView android:id="#+id/featured_title"
android:layout_width="280dp" android:layout_height="wrap_content" />
<TextView android:id="#+id/featured_txt"
android:layout_width="280dp" android:layout_height="wrap_content" />
</LinearLayout>
<ViewStub android:id="#+id/menu_container"
android:layout_width="wrap_content" android:layout_height="wrap_content">
</ViewStub>
<SlidingDrawer android:id="#+id/banner"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:handle="#+id/handle" android:content="#+id/content">
<TextView android:id="#id/handle" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="#drawable/bg_banner_title"
android:text="banner title" android:paddingLeft="50dp"
android:gravity="center_vertical" />
<ImageView android:id="#id/content"
android:layout_width="fill_parent" android:layout_height="100dp"
android:background="#286427" />
</SlidingDrawer>
</LinearLayout>
Layout inflated in the ViewStub:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/menu_cat_0" android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_height="100dp"
android:layout_marginTop="10dp">
<LinearLayout android:id="#+id/cat_2" android:tag="2"
android:orientation="vertical" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:gravity="center">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="#drawable/ic_cat_2" />
<TextView android:text="#string/cat_communes"
style="#style/IconTitle" />
</LinearLayout>
<LinearLayout android:id="#+id/cat_4" android:tag="4"
android:orientation="vertical" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:gravity="center">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="#drawable/ic_cat_4" />
<TextView android:text="#string/cat_hebergements"
style="#style/IconTitle" />
</LinearLayout>
<LinearLayout android:id="#+id/cat_3" android:tag="3"
android:orientation="vertical" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:gravity="center">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="#drawable/ic_cat_3_vide" />
<TextView android:text="#string/cat_agenda" style="#style/IconTitle" />
</LinearLayout>
<LinearLayout android:id="#+id/cat_10" android:tag="10"
android:orientation="vertical" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:gravity="center">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="#drawable/ic_cat_10" />
<TextView android:text="#string/cat_meteo" style="#style/IconTitle" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

Don't put it in a LinearLayout. Put it in a RelativeLayout, so it can float over top of earlier children.

Related

Add Textview On Viewflipper

i want show description of images in Viewflipper slidshow.I need to add textview or button on a viewflipper slideshow.So that only i can display image description based on textview or button click on viewflipper this is my xml
<?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"
android:scaleType="fitXY" >
<ViewFlipper
android:id="#+id/myflipper"
android:layout_width="match_parent"
android:layout_height="300dp"
android:gravity="center"
android:scaleType="fitXY" >
</ViewFlipper>
</LinearLayout>
You can use a FrameLayout for placing TextView over ViewFlipper like shown here:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
android:id="#+id/framelayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ViewFlipper
android:id="#+id/myflipper"
android:layout_width="match_parent"
android:layout_height="300dp"
android:gravity="center"
android:scaleType="fitXY" >
</ViewFlipper>
<TextView
android:id="#+id/mytext"
android:layout_width="match_parent"
android:layout_height="30dp"/>
</FrameLayout>
Check out this sample program blog for more examples of how to use FrameLayout.
Happy coding :)
You can use from this way in your Layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/KeepToolbar"
android:orientation="vertical">
<ViewFlipper
android:id="#+id/viewflipper"
android:layout_width="match_parent"
android:layout_height="150dp"
android:autoStart="true"
android:background="#color/ORANGE_700"
android:inAnimation="#anim/right_in"
android:outAnimation="#anim/left_out">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/a" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/a"
android:gravity="right"
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="AAAA" />
<TextView
android:id="#+id/e"
android:gravity="right"
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="asds" />
<TextView
android:id="#+id/w"
android:gravity="right"
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="qweqw" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/b" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/b"
android:gravity="right"
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="BBBB" />
<TextView
android:id="#+id/u"
android:gravity="right"
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="ssd" />
<TextView
android:id="#+id/vb"
android:gravity="right"
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="wwee" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/b" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/c"
android:gravity="right"
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="CCCC" />
<TextView
android:id="#+id/cd"
android:gravity="right"
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="asdfas" />
<TextView
android:id="#+id/cf"
android:gravity="right"
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="xxs" />
</LinearLayout>
</LinearLayout>
</ViewFlipper>

How to create a layout like this?

I want to show four images as shown in given imaages . each image must be equally far apart from others I have tried a LinearLayout and use it weight property but all in sane.
I have eight icons, four for selected state and four for unselected state. I have tried many ways,
Thanks in Advance.
Image Icons are ..
xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/bg" >
<FrameLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/bottom" />
<LinearLayout
android:id="#+id/bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/article_icn"
android:padding="10dp"
android:layout_margin="10dp"
android:scaleType="center" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/forum_icn"
android:padding="10dp"
android:layout_margin="10dp"
android:scaleType="fitXY" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/profile_icn"
android:padding="10dp"
android:layout_margin="10dp"
android:scaleType="fitXY" />
</LinearLayout>
</RelativeLayout>
I tried your code and modified a bit:
<?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" >
<FrameLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/bottom" />
<LinearLayout
android:id="#+id/bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:weightSum="3" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#drawable/icon"
android:padding="10dp"
android:scaleType="center" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#drawable/icon"
android:padding="10dp"
android:scaleType="fitXY" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#drawable/icon"
android:padding="10dp"
android:scaleType="fitXY" />
</LinearLayout>
</RelativeLayout>
Assigning android:weightSum="3" to container and weight 1 to all images works fine:
Output:
Check this layout, works exactly as you want. Just replace the image icons and background.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/bg" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:background="#517398" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center" >
<ImageButton
android:id="#+id/image_agenda"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="#drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center" >
<ImageButton
android:id="#+id/image_month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="#drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center" >
<ImageButton
android:id="#+id/image_month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="#drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center" >
<ImageButton
android:id="#+id/image_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="#drawable/ic_launcher" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
OUTPUT
You can use weight attrib:
<?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:background="#000000"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:src="#android:drawable/sym_action_chat" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:src="#android:drawable/sym_action_chat" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:src="#android:drawable/sym_action_chat" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:src="#android:drawable/sym_action_chat" />
</LinearLayout>
output is like this:
Try this..
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/bottom" />
<LinearLayout
android:id="#+id/bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#drawable/ic_launcher"
android:padding="10dp"
android:scaleType="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Textview" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#drawable/ic_launcher"
android:padding="10dp"
android:scaleType="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Textview" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#drawable/ic_launcher"
android:padding="10dp"
android:scaleType="fitXY" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Textview" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#drawable/ic_launcher"
android:padding="10dp"
android:scaleType="fitXY" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Textview" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
Screen

expandableListView listeners not working using a particular layout

ExpandableListView does not work using the following layout. OnGroupClickListener is never called when user clicks.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft"
android:focusable="false">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:focusable="false"
>
<ImageView
android:id="#+id/buttons_group_rowIV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:src="#drawable/radar_settings_gafas_led_off" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:orientation="vertical" >
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/darker_gray" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="fill_vertical"
android:weightSum="10" >
<TextView
android:id="#+id/buttons_group_row_TV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="9"
android:text="#string/interiorLED"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Switch
android:id="#+id/buttons_group_row_SW"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
But if I use the following layout all works fine. The only difference is the Switch Widget, that now is a ImageView:
<?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:gravity="center_vertical"
android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
>
<ImageView
android:id="#+id/buttons_group_rowIV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:src="#drawable/radar_settings_gafas_led_off" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:orientation="vertical" >
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#android:color/darker_gray" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="fill_vertical"
android:weightSum="10" >
<TextView
android:id="#+id/buttons_group_row_TV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="9"
android:text="#string/interiorLED"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:id="#+id/buttons_group_noSW_rowIV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:padding="5dp"
android:src="#drawable/radar_settings_gafas_led_off" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

android gridview stop selecting clicking effect when change layout

Below is my gridview layout which works fine and clicks. But when I change my layout it's not clicking any more. Tell me why I just change xml not code. Tell me what is wrong in my xml? Why gridView stopped clicking? is it because of layout weight?
I'm changing from this:
<?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" >
<ImageView
android:id="#+id/image2"
android:layout_width="wrap_content"
android:layout_height="70dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:padding="5dp"
android:scaleType="fitXY"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/title2"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:paddingTop="10dp"
android:textColor="#000" />
</LinearLayout>
To this:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="horizontal" >
<ImageView
android:id="#+id/image2"
android:layout_width="fill_parent"
android:layout_height="150dp"
android:layout_weight="1"
android:gravity="center_horizontal"
android:scaleType="fitXY"
android:src="#drawable/ic_launcher" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="2"
android:orientation="vertical" >
<TextView
android:id="#+id/title2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:gravity="center_vertical"
android:textColor="#000000" />
<TextView
android:id="#+id/title3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:orientation="vertical" >
<Button
android:id="#+id/ButtonSendFeedback"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/roundshapebtn"
android:text="Order Now"
android:textColor="#ffffff"
android:textSize="15pt" />
</LinearLayout>
You have some spaces in your layout maybe your click events did not trigger becasue of this. Just use below layout and check if your problem is solved:
<?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/image2"
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/title2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#DF013A" />
<TextView
android:id="#+id/title3"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#2EFEF7" />
</LinearLayout>
</LinearLayout>
<Button
android:id="#+id/ButtonSendFeedback"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="dummy"/>
</LinearLayout>

How to set content in a Linear layout to the BOTTOM of the Screen in Android.?

See the following XML code
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<include layout="#layout/header" />
<TextView
android:layout_width="fill_parent"
android:layout_height="18dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/header"
android:orientation="horizontal" >
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/calendar" />
<TextView
android:id="#+id/tvTitle"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:gravity="center"
android:text="#string/calendar"
android:textColor="#FFFFFFFF"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/myLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
<!-- <include layout="#layout/footer"/> -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#drawable/datename_bottom_bg"
android:orientation="horizontal">
<TextView
android:id="#+id/upgrade_4"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_weight="1"
android:drawableTop="#drawable/upgrade"
android:gravity="center"
android:text="#string/upgrade"
android:textSize="8sp" />
<TextView
android:id="#+id/panchang_4"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_weight="1"
android:drawableTop="#drawable/kalash_bottom"
android:gravity="center"
android:text="#string/panchang"
android:textSize="8sp" />
<TextView
android:id="#+id/time_range_4"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_weight="1"
android:drawableTop="#drawable/timer_bottom"
android:gravity="center"
android:text="#string/timespan"
android:textSize="8sp" />
<TextView
android:id="#+id/reminder_4"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_weight="1"
android:drawableTop="#drawable/reminder_bottom"
android:gravity="center"
android:text="#string/reminders"
android:textSize="8sp" />
<!--
<TextView android:id="#+id/calendar_4" android:layout_width="50dp" android:layout_height="50dp" android:drawableTop="#drawable/calendar_bottom"
android:text="#string/calendar" android:textSize="8sp" android:gravity="center" android:layout_weight="1"/>
-->
</LinearLayout >
</LinearLayout>
</ScrollView>
What this looks like is on the left and what I want it to look like is on the right, I also tried it by replacing LinearLayout to RelativeLaout but still not working. Please Help.!
You should use RelativeLayout, Look for example
<?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" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffff0000"
android:layout_above="#+id/bottom_panel">
</ScrollView>
<LinearLayout
android:id="#+id/bottom_panel"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<Button
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Button 1"/>
<Button
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Button 2"/>
<Button
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Button 3"/>
<Button
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Button 4"/>
</LinearLayout>
</RelativeLayout>
This will give you something similar. Just place your widgets instead of my buttons.
why dont you just use relative layout as parent layout set the view as alignparentbottom= true.then if really need it you can put a linear layout in the remaining space
You can include your LinearLayout into a FrameLayout and select in your LinearLayout the attribute android:layout_gravity="bottom":
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<!--Your LinearLayout content-->
</LinearLayout>
</FrameLayout>
Try relative layout inside which you can add linear layout.
set gravity:bottom to LinearLayout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:orientation="vertical" >
<include layout="#layout/header" />
<TextView
android:layout_width="fill_parent"
android:layout_height="18dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/header"
android:orientation="horizontal" >
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/calendar" />
<TextView
android:id="#+id/tvTitle"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:gravity="center"
android:text="#string/calendar"
android:textColor="#FFFFFFFF"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/myLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
<!-- <include layout="#layout/footer"/> -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#drawable/datename_bottom_bg"
android:orientation="horizontal">
<TextView
android:id="#+id/upgrade_4"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_weight="1"
android:drawableTop="#drawable/upgrade"
android:gravity="center"
android:text="#string/upgrade"
android:textSize="8sp" />
<TextView
android:id="#+id/panchang_4"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_weight="1"
android:drawableTop="#drawable/kalash_bottom"
android:gravity="center"
android:text="#string/panchang"
android:textSize="8sp" />
<TextView
android:id="#+id/time_range_4"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_weight="1"
android:drawableTop="#drawable/timer_bottom"
android:gravity="center"
android:text="#string/timespan"
android:textSize="8sp" />
<TextView
android:id="#+id/reminder_4"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_weight="1"
android:drawableTop="#drawable/reminder_bottom"
android:gravity="center"
android:text="#string/reminders"
android:textSize="8sp" />
<!--
<TextView android:id="#+id/calendar_4" android:layout_width="50dp" android:layout_height="50dp" android:drawableTop="#drawable/calendar_bottom"
android:text="#string/calendar" android:textSize="8sp" android:gravity="center" android:layout_weight="1"/>
-->
</LinearLayout >
</LinearLayout>

Categories

Resources