John Roberts
John Roberts

Reputation: 5966

TwoLineListItem Source Code

Since TwoLineListItem has been deprecated as of API 17, I have taken steps to replace it with custom XML and ViewHolder. However, I would really like for my app to look exactly as it had while using TwoLineListItem (since it is a big part of the application). Thus, I would like to know if it's possible to find the XML source code for the most recent TwoLineListItem that Android was using (all the ones I've found have been outdated), or do I have to basically go with trial and error?

Upvotes: 0

Views: 1113

Answers (1)

user
user

Reputation: 87064

I'm not sure what you're searching for. The TwoLineListItem is a simple widget which uses a layout that you could easily look at if you search the layout folder in the SDK/platforms/android-x/data/res/layout. Here is the one for Jelly Bean:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView android:id="@android:id/text1"
        android:textSize="16sp"
        android:textStyle="bold"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

    <TextView android:id="@android:id/text2"
        android:textSize="16sp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

</LinearLayout>

The widget's code is very simple to replicate.

Upvotes: 3

Related Questions