It's done. Sorry it took hours to figure out how I can have some
buttons along with the linear layout. Thanks again Mr King. lols. I
wish how to address you :)

On Sep 27, 4:50 pm, Varun Khanduja <varunkhand...@gmail.com> wrote:
> Thank you. i think I sort of got the results but I am probably not
> able to understand which property I should modify in the main.xml file
> to get the buttons properly aligned on the top. I am presently getting
> the 4 buttons but after several attempts of changing properties in xml
> file either they come vertically aligned or some other distortion
> happens. I am trying to make them equally sized with horizontal
> alignment. Help would be highly appreciated. Thanks
>
> Here is how i modified the java code.
>
> package com.varun.HelloListView;
>
> import java.util.Arrays;
> import java.util.Collections;
> import java.util.List;
>
> import android.app.ListActivity;
> import android.os.Bundle;
> import android.view.View;
> import android.widget.ArrayAdapter;
> import android.widget.Button;
> import android.widget.ListView;
> import android.widget.TextView;
>
> public class HelloListView extends ListActivity {
>         TextView selection;
>
>         @Override
>         public void onCreate(Bundle icicle) {
>                 super.onCreate(icicle);
>
>                 setContentView(R.layout.main);
>                 setListAdapter(new ArrayAdapter(this, R.layout.list_item,
> R.id.label,AndroidPhones));
>
>         }
>
>         static final String[] AndroidPhones = new String[] {
>                 "HTC Evo 4G",  "Google Nexus One", "Motorola Devour",
>                 "Motorola CLIQ", "Samsung Galaxy S", "Motorola Droid",
>                 "myTouch 3G Slide", "Droid Eris", "Motorola Backflip",
>                 "Motorola i1", "HTC Hero", "myTouch 3G Fender",
>                 "HTC Droid Incredible",  "Samsung Moment", "LG Ally ",
>         };
>
> }
>
> Here is my main.xml code where the buttons are declared,
>
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>     android:orientation="vertical"
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent"
>     >
>
> <TextView
>           android:id="@+id/textViewHello"
>     android:layout_width="fill_parent"
>     android:layout_height="wrap_content"
>     android:text="@string/hello"
>     />
>     <Button
> android:id="@+id/button_previous"
> android:layout_height="wrap_content"
> android:layout_width="110px"
> android:layout_alignParentLeft="true"
> android:textSize="15sp"
> android:typeface="monospace"
> android:textColor="#ffFFffFF"
> android:text="@string/PreviousButton"
>
> </Button>
> <Button
> android:id="@+id/button_next"
> android:layout_height="wrap_content"
> android:layout_width="110px"
> android:layout_alignParentRight="true"
> android:textSize="15sp"
> android:typeface="monospace"
> android:textColor="#ffFFffFF"
> android:text="@string/NextButton"
>
> </Button>
> <ListView
>         android:id="@android:id/list"
>         android:layout_width="fill_parent"
>         android:layout_height="fill_parent"
>         android:drawSelectorOnTop="false"
>         />
> </LinearLayout>
>
> On Sep 27, 2:23 pm, TreKing <treking...@gmail.com> wrote:
>
>
>
> > On Mon, Sep 27, 2010 at 4:15 PM, Varun Khanduja 
> > <varunkhand...@gmail.com>wrote:
>
> > > I am trying to declare two seperate buttons but only one of the buttons
> > > comes visible.
>
> > ListView takes one header view, AFAIK. Each function you have there returns
> > one button. Assuming you're calling listView.setHeader(buildHeader()) then
> > listView.setHeader(buildHeader2()), then the second call will overwrite the
> > first.
>
> > You should create a linear or relative layout that contains both buttons
> > then set THAT as the header view.
>
> > --------------------------------------------------------------------------- 
> > ----------------------
> > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> > transit tracking app for Android-powered devices

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

Reply via email to