Reputation: 411
I've created a ListView in an activity in a java file. For this LIstView I call the android.R.layout.simple_list_item_1 layout view which is a default layout that I did not create myself. I want to create a custom layout in place of simple_list_item_1, but I don't want to have to start from scratch. How can I find this default layout so I can make slight edits to it? The reason I don't want to start from scratch is because all I really want to do is make the text size a bit smaller. If this is possible without editing the file (rather programmatically), then that answer would be fine too. Thanks!
Upvotes: 2
Views: 2185
Reputation: 23
I'm not sure that making changes to
<android-sdk>/platforms/android-7/data/res/layout/simple_list_item_1.xml
is realy good idea.
I would rather apply changes to Android default layout in java code. Something like this (in your adapter):
public View getView( int position, View convertView, ViewGroup parent )
{
if ( null == convertView )
{
LayoutInflater layoutInflater = LayoutInflater.from( getContext( ) );
convertView = layoutInflater.inflate( android.R.layout.simple_list_item_1, null );
}
TextView textView = ( TextView ) convertView.findViewById( android.R.id.text1 );
textView.setText( "Content ..." );
// Set your font here ...
return convertView;
}
Upvotes: 1
Reputation: 9908
The layout file you're looking for is located in
<android-sdk>/platforms/android-7/data/res/layout/simple_list_item_1.xml
Where <android-sdk>
is where you installed the SDK.
Upvotes: 5