Alignment of View Elements within a LinearLayout
- by Adam
I hate to ask this question; for some reason I can't figure it out on my own. I have a vertical LinearLayout that contains a custom View that I've defined in my app and and a TextView. I'd like my custom View to be aligned on the top of the screen and the TextView to be aligned at the bottom of the screen. Unfortunately, no matter what changes I make to the attributes of the XML file, my custom View always seems to be centered vertically when I run the emulator. The xml is like the following:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:gravity="top">
<CustomView
android:id="@+id/customID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tileSize="24"
android:focusableInTouchMode="true" android:layout_gravity="top"/>
<TextView
android:id="@+id/text"
android:text="@string/droidtactoe_layout_text"
android:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textSize="24sp" android:textColor="#00000000" android:layout_gravity="bottom"/>
</LinearLayout>