Hi Im trying to create a simple android page with text at the top of the page and an image below it. Ive tried using both linear and relative layouts but I just cannot get the image to display below the text. Either the image is next to the text either on the left or off the screen to the right, or when using a relative layout the image takes up the entire screen.
Is there any image properties that will allow to accomplish this, I do not want to use the deprecated absolute layout if possible.
Here is the code that I am working with:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/gripbckgrnd" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="140dp"
android:layout_height="211dp"
android:src="@drawable/grip1" />
<TextView
android:id="@+id/textView1"
android:layout_width="356dp"
android:layout_height="wrap_content"
android:layout_marginTop="97dp"
android:gravity="center_horizontal"
android:text="@string/griptext"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
Thanks in advance
When using
LinearLayout, you can specify the orientation-attribute like so:(The default is horizontal, which causes your problems)