Good point!  An even further simplification with this change -

--- res/layout/mylistview.xml ---
<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:entries="@array/mylistviewdata"/>


On Feb 17, 3:03 pm, Romain Guy <[email protected]> wrote:
> The RelativeLayout here is useless :)
>
>
>
> On Wed, Feb 17, 2010 at 7:24 PM, jotobjects <[email protected]> wrote:
> > Thought this might be interesting for others.  Here is a bare bones
> > simple  ListView widget in a base Activity - NOT a ListActivity.
> > There is no explicit Adapter - it uses the "android:entries" attribute
> > to load the list data from a resource.  Probably not something you
> > would use in a real app, but maybe instructive for understanding the
> > ListViews.
>
> > --- MyListActivity.java ---
> > package foo.listview;
>
> > import android.app.Activity;
> > import android.os.Bundle;
>
> > public class MyListActivity extends Activity
> > {
> >   �...@override
> >    public void onCreate(Bundle savedInstanceState) {
> >        super.onCreate(savedInstanceState);
> >        setContentView(R.layout.mylistview);
> >    }
> > }
>
> > --- res/layout/mylistview.xml ---
> > <?xml version="1.0" encoding="utf-8"?>
> > <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
> > android"
> >    android:layout_width="fill_parent"
> >    android:layout_height="fill_parent">
> >        <ListView
> >           android:layout_width="fill_parent"
> >           android:layout_height="fill_parent"
> >           android:entries="@array/mylistviewdata"/>
> > </RelativeLayout>
>
> > --- res/values/mylistdata.xml ---
> > <?xml version="1.0" encoding="utf-8"?>
> > <resources>
> >    <string-array name="mylistviewdata">
> >        <item>"1952 Albert Schweitzer"</item>
> >        <item>"1954 UN Office for Refugees"</item>
> >        <item>"1962 Linus Pauling"</item>
> >        <item>"1964 Martin Luther King"</item>
> >        <item>"1975 Andrei Sakharov"</item>
> >        <item>"1978 Anwar Sadat &amp; Menachem Begin"</item>
> >        <item>"1977 Amnesty International"</item>
> >        <item>"1979 Mother Teresa"</item>
> >    </string-array>
> > </resources>
>
> > --
> > 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
>
> --
> Romain Guy
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  All such questions should be posted on
> public forums, where I and others can see and answer them

-- 
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