Reputation: 1903
I have just finished my application and now I am trying to style it. Throughout the application I used a combination of fragments and activities.
I have been using a lot of list either using the default ListFragment style or just a simpleCursorAdapter list style. My problem is trying to make the lists the same.
I am trying to style the two the same way as the default ListFragment, which has well spaced rows with easy to read writing.
Does anyone know what style this is? Or an easy styling method to make the all the lists the same?
Upvotes: 0
Views: 78
Reputation: 1903
To solve this I created a new XML layout containing the same attributes as android simple list view and then applied that to all the lists to make them the same.
Listview.XML
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/recipeName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:minHeight="?android:attr/listPreferredItemHeightSmall" />
Upvotes: 0
Reputation: 556
Hope this helps :)
listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, MobileMuni.getBookmarkStore().getRecentLocations()) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView textView = (TextView) super.getView(position, convertView, parent);
String currentLocation = RouteFinderBookmarksActivity.this.getResources().getString(R.string.Current_Location);
int textColor = textView.getText().toString().equals(currentLocation) ? R.color.holo_blue : R.color.text_color_btn_holo_dark;
textView.setTextColor(RouteFinderBookmarksActivity.this.getResources().getColor(textColor));
return textView;
}
});
Upvotes: 1
Reputation: 556
Why dont you make a common xml file for the layout of the list view and then use it in adapter instead of making use of system default one's.
Upvotes: 1