If you only want the buttons in the "top-level" content layout, then add them to the layout file that you use with setContent() in your activity's onCreate.

-- Kostya

23.12.2010 12:08, pramod.deore пишет:
Now I had changed in xml file but still not getting expected view.
Here it shows checkbox,items and on every row these 2 buttons are also
displayed . I want these 2 buttons only on top of list. my xml file is

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#81BEF7"
        android:scrollbars="vertical">

        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
        android:id="@+id/buttonlayout"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:height="32dp"
        android:gravity="left|top"
        android:background="#2B60DE"
        android:paddingTop="2dp"
        android:paddingBottom="2dp">

        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
        android:id="@+id/buttonlayout2"
        android:orientation="horizontal"
        android:layout_height="wrap_content"
        android:gravity="left|center_vertical"
        android:layout_width="wrap_content"
        android:layout_gravity="left|center_vertical">

                <TextView android:id="@+id/txtTest"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:textStyle="bold"
                android:textColor="#FFFFFF"

                android:textSize="15sp"
                android:gravity="center_vertical"
                android:paddingLeft="5dp">
                </TextView>

                <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
                android:id="@+id/buttonlayout2"
                android:orientation="horizontal"
                android:layout_height="wrap_content"
                android:gravity="right"
                android:layout_width="fill_parent"
                android:layout_gravity="right|center_vertical">

                        <Button android:id="@+id/btnSave"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Save"
                        android:textSize="15sp"
                        android:layout_marginLeft="10px"
                        android:layout_marginRight="10px"
                        android:layout_marginBottom="2px"
                        android:layout_marginTop="2px"
                        android:height="15dp"
                        android:width="70dp">
                        </Button>

                        <Button android:id="@+id/btnClear"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Clear"
                        android:textSize="15sp"
                        android:layout_marginLeft="10px"
                        android:layout_marginRight="10px"
                        android:layout_marginBottom="2px"
                        android:layout_marginTop="2px"
                        android:height="15dp"
                        android:width="70dp">
                        </Button>
        </LinearLayout>

</LinearLayout>

        <TableLayout
                android:id="@+id/TableLayout01"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:stretchColumns="*">
                <TableRow>
                        <CheckBox
                android:id="@+id/switches"
                android:layout_height="wrap_content"
                android:text=""
                android:layout_width="wrap_content">
        </CheckBox>



             <TextView android:id="@+id/room"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:textColor="#00ccff"

             />

                </TableRow>

        </TableLayout>

        </LinearLayout>
</LinearLayout>

On Dec 23, 11:52 am, TreKing<[email protected]>  wrote:
On Thu, Dec 23, 2010 at 12:48 AM, pramod.deore<[email protected]>wrote:

Actually if suppose there are 12 list items, then these 2 buttons are shown
12 times and
list of items and checkboxes are not visible.
Sounds like you are using this layout as the entry for a list view. Don't do
that. Split your layout out into two parts - one with the buttons and one
with the content you want to see in th list view. Then your main layout adds
the button layout and a listview below it.

-------------------------------------------------------------------------------------------------
TreKing<http://sites.google.com/site/rezmobileapps/treking>  - Chicago
transit tracking app for Android-powered devices


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to