Doraemon Nobita
Doraemon Nobita

Reputation: 39

Simple XML Android layout issue : The buttons are appearing at bottom of the interface

How can I modify the main.xml so the buttons appear immediately below the ImageView object?

thanks a lot, world-class experts on Stack Overflow!!

here is my main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:scaleType="fitStart"
        android:src="@drawable/genie" />

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:scaleType="fitStart"
    android:layout_width="wrap_content"
    android:layout_gravity = "center"
    android:layout_height="wrap_content"
    >
<Button android:text="RWD" android:id="@+id/b1" android:layout_width="60dp" android:layout_height="60dp"></Button>
<Button android:text="PLAY " android:id="@+id/b2" android:layout_width="60dp" android:layout_height="60dp"></Button>
<Button android:text="FWD" android:id="@+id/b3" android:layout_width="80dp" android:layout_height="60dp"></Button>
<Button android:text="LIST" android:id="@+id/b4" android:layout_width="60dp" android:layout_height="60dp"></Button>
<Button android:text="RWD" android:id="@+id/b5" android:layout_width="60dp" android:layout_height="60dp"></Button>

        </LinearLayout>


</LinearLayout>

Upvotes: 0

Views: 94

Answers (1)

Entreco
Entreco

Reputation: 12900

Use a RelativeLayout instead of LinearLayout. In a relativelayout you can use android:below="@id/imageVIew1" to position your buttons below the imageview. Take a look at the documentation for more info, good luck

Upvotes: 1

Related Questions