Reputation: 606
Hi I want to know how do I align the box to the bottom of the android screen? I have already made the box as a 9patch png image and still there is some gap between the actual image and the border. Can anyone please help me? What I mean that there is an actual gap between the blue border on the graphical layout screen that controls the size of the image and the actual image. Pardon me for my English.
This is the xml code for the blue box
<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" >
<ImageView
android:id="@+id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/background" />
<ImageView
android:id="@+id/topbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/top_bar" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/topbar"
android:layout_centerHorizontal="true"
android:layout_marginTop="95dp"
android:src="@drawable/icon_green" />
<ImageView
android:id="@+id/box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="23dp"
android:src="@drawable/box" />
</RelativeLayout>
Upvotes: 1
Views: 448
Reputation: 606
Problem solved guys. Actually it turns out the box was hovering because the width of the box is too big on the screen I guess. And after switching to a larger screen (5.4 inch, previously was 4 inch) on the graphical layout the box was right at the bottom. Thanks for the help :) well that was silly, sorry for the fuss, I'm new in android.
Upvotes: 0
Reputation: 290
Don't understand the question fully but try adding
android:adjustViewBounds="true"
to your ImageViews.
And i see the view with id 'box' is aligned to the bottom and has a bottom margin of 23dp. This will create a gap on the bottom of the screen ;)
Upvotes: 1