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:

  • Android TextView's subscript being clipped off
  • After upgrade Android on Nexus to 4.2.2, Eclipse shows target unknown for device?
  • ClassLoader referenced unknown path: /data/app/
  • Overriding View.onSaveInstanceState() and View.onRestoreInstanceState() using View.BaseSavedState?
  • Appcompat “java.lang.IllegalArgumentException: parameter must be a descendant of this view” in ViewGroup.offsetRectBetweenParentAndChild
  • Android Gallery on Android 4.4 (KitKat) returns different URI for Intent.ACTION_GET_CONTENT
  • android.R.layout.simple_list_item_1
    

    Related posts:

    Android AutoCompleteTextView with Custom Adapter filtering not working
    Load an SWF into a WebView
    Why does Intent.createChooser() need a BroadcastReceiver and how to implement?
    set up device for development (?????? no permissions)
    Are vector images usefull for Android?
    How exactly does theme inheritance work in Android?
  • unable to pass null to execute(); method of AsyncTask in android 4.0
  • Android - While switching between two activities, the calling order of lifecycle methods of Activity
  • Exception when opening Parse push notification
  • Popup DatePicker for EditText
  • Writeable and Executable location on Android
  • Turning on screen programmatically
  • 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.