简体   繁体   中英

stick LinearLayour ( horizontal ) to the buttom without any space

Sorry, i've completed my question very much, so I reasked that and deleted prev post...

I'm using LinearLayout ( with 4 ImageButtons in a raw ) in a RelativeLayout in my project and I have used android:layout_alignParentBottom="true" for it ( linear ) to stick to the buttom of RelativeLayout, but my problem is the space between LinearLayout's ImageButtons and the corners of the screen. I want to remove them to make my ImageButtons be like a menu bar on the bottom of the screen. Is it possible for anyone to help me please ? THANK YOU ! :)

<?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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".HomeActivity">

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:gravity="center"
    android:text="TXT"
    android:textAppearance="?android:attr/textAppearanceLarge" />


<LinearLayout
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:layout_alignParentBottom="true"
 android:orientation="horizontal"
 android:weightSum="4" >

<ImageButton
    android:id="@+id/calibrate"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:src="@drawable/1" />

<ImageButton
    android:id="@+id/chart"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:src="@drawable/2" />

<ImageButton
    android:id="@+id/guidance"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1" 
    android:src="@drawable/3" />

<ImageButton
    android:id="@+id/info"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1" 
    android:src="@drawable4" />

</LinearLayout>

 </RelativeLayout>

and the result is something like this : Picture http://uploadtak.com/images/c6645_1311.png ! 1

Remove the padding on your RelativeLAyout

From:

<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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".HomeActivity">

To:

<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" >

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM