What is “android.R.layout.simple_list_item_1”?

I’ve started learning Android development and am following a todolist example from a book:

// Create the array list of to do items
final ArrayList<String> todoItems = new ArrayList<String>();

// Create the array adapter to bind the array to the listView
final ArrayAdapter<String> aa;
aa = new ArrayAdapter<String>(  this, 
                                android.R.layout.simple_list_item_1,
                                todoItems
                            );
myListView.setAdapter(aa);

I can’t understand exactly this code especially this line:

  • Draw part of image to screen (without loading all to memory)
  • Run JavaFX app with external libraries in Android?
  • Zoom effect on Android SurfaceView
  • How to add application shortcuts programitically in android
  • onCreateOptionsMenu is never called
  • How to set onBackButton listener to an activity
  • android.R.layout.simple_list_item_1
    

    Related posts:

    How to enable Firebase Crash Reporting - Android
    Android: Changing visibility on menu items with changing fragment
    Center layout Android
    How to set Internet options for Android emulator?
    Do Google Maps API limits apply to Android applications?
    How to properly use setZOrderMediaOverlay on Android?
  • Send and Receive IQ XMPP ASMACK Android
  • Google map v2 Custom Infowindow with two clickable buttons or ImageView
  • How to change background color of action bar without increasing min sdk?
  • open a dialog when i click a button
  • Gradle: Only resolve dependencies for the desired variant
  • Google Maps API v2 SupportMapFragment inside ScrollView - users cannot scroll the map vertically
  • 7 Solutions collect form web for “What is “android.R.layout.simple_list_item_1”?”

    Zakaria, that is a reference to an built-in XML layout document that is part of the Android OS, rather than one of your own XML layouts.

    Here is a further list of layouts that you can use:
    http://developer.android.com/reference/android/R.layout.html
    (Updated link thanks @Estel: https://github.com/android/platform_frameworks_base/tree/master/core/res/res/layout )

    You can actually view the code for the layouts.

    This is a part of the android OS. Here is the actual version of the defined XML file.

    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> 
    

    as answered above by: kcoppock and Joril

    go here : https://github.com/android/platform_frameworks_base/tree/master/core/res/res/layout

    just right click the layout file you want, then select ‘Save As’, save somewhere, then copy it in ‘layout’ folder in your android project(eclipse)…

    you can see how the layout looks like 🙂

    way to go…

    android.R.layout.simple_list_item_1, this is row layout file in your res/layout folder which contains the corresponding design for your row in listview. Now we just bind the array list items to the row layout by using mylistview.setadapter(aa);

    As mentioned by Klap “android.R.layout.simple_list_item_1 is a reference to an built-in XML layout document that is part of the Android OS”
    All the layouts are located in: sdk\platforms\android-xx\data\res\layout
    To view the XML of layout :
    Eclipse: Simply type android.R.layout.simple_list_item_1 somewhere in code, hold Ctrl, hover over simple_list_item_1, and from the dropdown that appears select “Open declaration in layout/simple_list_item_1.xml”. It’ll direct you to the contents of the XML.
    Android Studio: Project Window -> External Libraries -> Android X Platform -> res -> layout, and here you will see a list of available layouts.
    enter image description here

    No need to go to external links, everything you need is located on your computer already:

    Android\android-sdk\platforms\android-x\data\res\layout.

    Source code for all android layouts are located here.

    Per Arvand:
    Eclipse: Simply type android.R.layout.simple_list_item_1 somewhere in code, hold Ctrl, hover over simple_list_item_1, and from the dropdown that appears select Open declaration in layout/simple_list_item_1.xml. It’ll direct you to the contents of the XML.

    From there, if you then hover over the resulting simple_list_item_1.xml tab in the Editor, you’ll see the file is located at C:\Data\applications\Android\android-sdk\platforms\android-19\data\res\layout\simple_list_item_1.xml (or equivalent location for your installation).

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.