Can anybody tell the source of android.R.layout.simple_list_item_1

13705 views
Skip to first unread message

Chunyu Jiang

unread,
Jan 10, 2008, 4:04:29 PM1/10/08
to android-d...@googlegroups.com
Hi, guys
I am trying to get warmed up with ListActivity.
Can anybody tell me the source of android.R.layout.simple_list_item_1?
android.R.layout.simple_list_item_2 will be even nicer.
Thanks
 

 

hackbod

unread,
Jan 10, 2008, 6:22:44 PM1/10/08
to Android Developers
simple_list_item_1:

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/listItemFirstLineStyle"
android:paddingTop="2dip"
android:paddingBottom="3dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />

simple_list_item_2:

<TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/
android"
android:paddingTop="2dip"
android:paddingBottom="2dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<TextView android:id="@android:id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/listItemFirstLineStyle"/>

<TextView android:id="@android:id/text2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@android:id/text1"
style="?android:attr/listItemSecondLineStyle" />
</TwoLineListItem>
Message has been deleted
Message has been deleted

CJ

unread,
Jan 13, 2008, 12:55:56 PM1/13/08
to Android Developers
Can anybody make it clear. For example, where to get this source
(link) and how to take the useful info out of the it.


On Jan 10, 9:38 pm, "Romain Guy" <romain...@google.com> wrote:
> It's in the source code :)
>
> --
> Romain Guywww.curious-creature.org

Romain Guy

unread,
Jan 13, 2008, 1:39:13 PM1/13/08
to android-d...@googlegroups.com
The source code of the SDK is not yet available.

On Jan 13, 2008 9:55 AM, CJ <Chunyu...@gmail.com> wrote:

Can anybody make it clear. For example, where to get this source
(link) and how to take the useful info out of the it.


On Jan 10, 9:38pm, "Romain Guy" < romain...@google.com> wrote:
> It's in the source code :)
>
> --
> Romain Guywww.curious-creature.org
Message has been deleted
Message has been deleted

trickybit

unread,
Jan 16, 2008, 1:41:57 PM1/16/08
to Android Developers
Could somebody write a program to load a stock layout resource, and
then crawl the resulting views & associated layoutparms to reproduce
the information below? Might have to do work to reproduce the view
IDs in symbolic form, etc.

While you're at it, whoever volunteers, write a program to display all
the stock image resources in a scrolling list for our enjoyment... :-)

And visualizers for the stock animations......

Thanks! :-)
Jim
Message has been deleted

Eric B

unread,
Feb 11, 2008, 1:20:16 AM2/11/08
to Android Developers

Mark Assad

unread,
Feb 11, 2008, 3:10:33 AM2/11/08
to Android Developers
I've been using the code below to decode the XML. Not pretty. but it
gives you a summary of the XML. It should be cleaned up, but I haven't
had the time to do that yet. I was hoping if I put it here someone
else might like clean it up. :)

The code will load (and decode!) all XML resources in an application,
and display them on the log.


Resources r2;
r2 =
this.getPackageManager().getResourcesForApplication("com.google.android.contacts");
int start = R.layout.main;
while (true) {

XmlPullParser xpp = r2.getXml(start);
start++;

eventType = xpp.getEventType();
while (eventType !=
XmlPullParser.END_DOCUMENT) {
if(eventType ==
XmlPullParser.START_DOCUMENT) {
Log.w(LOG_TAG, "Start
document");
} else if(eventType ==
XmlPullParser.END_DOCUMENT) {
Log.w(LOG_TAG, "End
document");
} else if(eventType ==
XmlPullParser.START_TAG) {
int count =
xpp.getAttributeCount();
String tag = "<" +
xpp.getName();
for (int i = 0 ; i
<count; ++i) {
String attrNS
= xpp.getAttributeNamespace(i);
String
attrName = xpp.getAttributeName(i);
if (attrNS !=
null) {

attrName = attrNS + ":" + attrName;
}
String value =
xpp.getAttributeValue(i);
tag += " " +
attrName + "=\"" + value +"\"";
Log.w(LOG_TAG,
tag);
tag = "";
}
tag += ">";
Log.w(LOG_TAG, tag);
} else if(eventType ==
XmlPullParser.END_TAG) {
Log.w(LOG_TAG,
"</"+xpp.getName() + ">");
} else if(eventType ==
XmlPullParser.TEXT) {
Log.w(LOG_TAG,
xpp.getText());
} else {
Log.w(LOG_TAG,
"Something else: " + eventType);
}
eventType = xpp.next();
}
Log.w(LOG_TAG, "DONE");
}

If you do something with this, I'd be really keen to hear about it.

Regards,
Mark.

Eric B

unread,
Feb 11, 2008, 11:10:34 PM2/11/08
to Android Developers
Hopefully they will release the source soon, and hopefully it will
include everything uncompressed.

Thanks,
Eric
Message has been deleted

Peli

unread,
Feb 19, 2008, 6:21:24 AM2/19/08
to Android Developers
Thank you Mark! The code is really great!

Do you know by chance how I would have to change your code so that I
could access the android resources directly? Like to display the xml
for android.R.layout.simple_list_item_1? (I'd like to know the padding
used there)

Peli

On Feb 11, 9:10 am, Mark Assad <mas...@gmail.com> wrote:
> I've been using the code below to decode theXML. Not pretty. but it
> gives you a summary of theXML. It should be cleaned up, but I haven't
> had the time to do that yet. I was hoping if I put it here someone
> else might like clean it up. :)
>
> The code will load (and decode!) allXMLresources in an application,
> > the stock image resources in a scrollinglistfor our enjoyment... :-)
Message has been deleted
Message has been deleted
Message has been deleted

Mark Assad

unread,
Feb 20, 2008, 6:25:35 AM2/20/08
to Android Developers
Hi,

I've cleaned this up a little bit now and put together a simple web
page for it. It's still pretty rough -- sorry -- What I'd give to have
more time to work on these things.

http://www.it.usyd.edu.au/~massad/project-android.html

I've updated the code so that it now outputs to files instead of the
Android Log, and I've collected all the files into one .tgz file.
(This is just for the android.R.layout)

Mark.

On Feb 20, 7:54 am, Peli <peli0...@googlemail.com> wrote:
> Thanks a lot! Now I got it. Actually I had also tried what you
> suggested, but probably got confused by the many XML layouts that came
> as output.. I had not realized that start++ also iterates through all
> following layouts... So if I just look at the first one, everything is
> fine!
>
> Thanks!
>
> Peli
>
> On 19 Feb., 18:06, Bob Pesner <pcdial...@gmail.com> wrote:
>
> > Hi,
>
> >   You can replace:
>
> >      int start = R.layout.main;
>
> > at the begining with:
>
> >     int start = android.R.layout.simple_list_item_1;
>
> > On Feb 19, 6:21 am, Peli <peli0...@googlemail.com> wrote:
>
> > > Thank you Mark! The code is really great!
>
> > > Do you know by chance how I would have to change your code so that I
> > > could access the android resources directly? Like to display the xml
> > > for android.R.layout.simple_list_item_1? (I'd like to know the padding
> > > used there)
>
> > > Peli
>
> > > On Feb 11, 9:10 am, Mark Assad <mas...@gmail.com> wrote:
>
> > > > I've been using the code below to decode theXML. Not pretty. but it
> > > > gives you a summary of theXML. It should be cleaned up, but I haven't
> > > > had the time to do that yet. I was hoping if I put it here someone
> > > > else might like clean it up. :)
>
> > > > The code will load (and decode!) allXMLresources in an application,
> > > > and display them on the log.
>
> > > >                         Resources r2;
> > > >                         r2 =
> > > > this.getPackageManager().getResourcesForApplication("com.google.android.con ­tacts");
> > > > > > > Thanks- Zitierten Text ausblenden -
>
> > - Zitierten Text anzeigen -

Peli

unread,
Feb 20, 2008, 6:15:42 PM2/20/08
to Android Developers
Hi Mark,

Thanks a lot for your work! Your program is really great.

Just a quick remark: When I open your android_r_layout file, I see
something like:

android_r_layout/
< I m a g e V i e w h t t p : / /
etc...

so it seems your file mixes standard and unicode characters or
something similar. Probably I don't have the right program to display
this properly. If you have some way of fixing this, it would be great,
but your file is useful even if you don't. :-)

Thanks,
Peli
> > > - Zitierten Text anzeigen -- Zitierten Text ausblenden -
Reply all
Reply to author
Forward
Message has been deleted
0 new messages