xaaam
xaaam

Reputation: 17

adding buttons to relativelayout with listview

I am trying to add two buttons to my relativelayout that includes a listview

i can only get one to show up.

I want them to be at the top of my listview kinda like tabs..

http://m4x.co/orig.jpg

http://m4x.co/new.jpg

the first image is what it looks like, the 2nd is something similar to what i want.

i would of posted here but "We're sorry, but as a spam prevention mechanism, new users aren't allowed to post images. Earn more than 10 reputation to post images."

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" 
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#FFFFFF"


>

<Button android:id="@+id/plus"
android:background="@drawable/selector"
android:layout_width="75dip"
android:layout_height="75dip"
android:layout_alignParentBottom="true"

/>
<Button android:id="@+id/main2"
     android:layout_height="20dp" 
     android:layout_width="40dp" 
     android:hint="Notes"
     android:background="#FFFFFF"
     android:layout_above="@+id/list"
     >

</Button>
<Button android:id="@+id/main3"

     android:layout_height="20dp" 
     android:layout_width="40dp" 
     android:hint="Titles"
     android:background="#FFFFFF"
          android:layout_above="@+id/list">

</Button>
<ListView 
    android:layout_marginTop="70dp" 
    android:id="@android:id/list" 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
      android:layout_above="@+id/plus"
      android:smoothScrollbar="true"
      android:background="#FFFFFF" android:cacheColorHint="#FFFFFF"
  android:fastScrollEnabled="true" android:clickable="true"
  android:layout_marginBottom="10dp" 
          android:divider="#000000"
    android:dividerHeight="1px"
>

</ListView>



<TextView android:id="@android:id/empty" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/noQ" 


 />


    </RelativeLayout>

Upvotes: 0

Views: 455

Answers (1)

kmb64
kmb64

Reputation: 1513

I think this is about what you are looking for:

<?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#000000"
        android:orientation="vertical" >

        <Button
            android:id="@+id/plus"
            android:background="@drawable/selector"
            android:layout_width="75dip"
            android:layout_height="75dip"
            android:layout_alignParentBottom="true" />

        <ListView
            android:id="@android:id/list"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/plus"
            android:layout_marginBottom="10dp"
            android:layout_marginTop="70dp"
            android:background="#FFFFFF"
            android:cacheColorHint="#FFFFFF"
            android:clickable="true"
            android:divider="#000000"
            android:dividerHeight="1px"
            android:fastScrollEnabled="true"
            android:smoothScrollbar="true" >
        </ListView>

        <Button
            android:id="@+id/main3"
            android:layout_width="40dp"
            android:layout_height="20dp"
            android:layout_alignParentTop="true"
            android:background="#FFFFFF"
            android:hint="Titles" />

        <Button
            android:id="@+id/main2"
            android:layout_width="40dp"
            android:layout_height="20dp"
            android:layout_alignParentTop="true"
            android:layout_marginLeft="16dp"
            android:layout_toRightOf="@+id/main3"
            android:background="#FFFFFF"
            android:hint="Notes" />

        <TextView
            android:id="@android:id/empty"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/main2"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="20dp"
            android:text="@string/noQ" />

    </RelativeLayout>

Upvotes: 1

Related Questions