Reputation: 53600
I have two questions.
The first, when i load the activity first item of gallery is in the middle. How to ask android to align it to left? (actually i used align="left" but it seems doesn't work)
the second, my activity includes three items, header, body and footer. currently the footer (gallery) is on top of body. I want bottom of body stays on above of footer instead of behind of footer.
any suggestions appreciated. The image is like this.
the code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
android:background = "@drawable/bg" >
<!-- Loading header of this UI which is coded separately -->
<include
android:id="@+id/header"
layout="@layout/header_bar" />
<GridView
android:id="@+id/news_gridview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:numColumns="2"
android:verticalSpacing="5dp"
android:horizontalSpacing="5dp"
android:layout_below="@id/header"
android:layout_centerInParent="true" />
<Gallery
android:id="@+id/gallery"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
</RelativeLayout>
Upvotes: 0
Views: 4244
Reputation: 128428
For 1st:
Check this existing SO question:
For 2nd:
- You need to include android:layout_above="@+id/gallery"
in your GridView.
- Remoev android:layout_centerInParent="true"
In short, define:
<GridView
android:id="@+id/news_gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="10dip"
android:numColumns="2"
android:verticalSpacing="5dp"
android:horizontalSpacing="5dp"
android:layout_below="@+id/header"
android:layout_above="@+id/gallery"/>
Upvotes: 3