Sample ListView example
//Sample ListView example
ListView fontListView = (ListView) findViewById(R.id.fontlistView);
ArrayList<String> fontListData = Font.getFontStyles();
ArrayAdapter<String> fontListAdapter = new ArrayAdapter<String>(this, R.layout.listview_style_layout, fontListData);
fontListView.setAdapter(fontListAdapter);
In the xml
<TableLayout android:id="@+id/listViewTableLayout" android:layout_width="wrap_content" android:layout_height="wrap_content">
<TableRow android:paddingBottom="5dip">
<ListView android:id="@+id/fontlistView"
android:scrollbars="vertical"
android:choiceMode="singleChoice"
android:layout_height="wrap_content"
android:layout_width="200dip"
android:layout_gravity="center_horizontal"
android:scrollbarAlwaysDrawVerticalTrack="true">
</ListView>
</TableRow>
</TableLayout>
ListView fontListView = (ListView) findViewById(R.id.fontlistView);
ArrayList<String> fontListData = Font.getFontStyles();
ArrayAdapter<String> fontListAdapter = new ArrayAdapter<String>(this, R.layout.listview_style_layout, fontListData);
fontListView.setAdapter(fontListAdapter);
In the xml
<TableLayout android:id="@+id/listViewTableLayout" android:layout_width="wrap_content" android:layout_height="wrap_content">
<TableRow android:paddingBottom="5dip">
<ListView android:id="@+id/fontlistView"
android:scrollbars="vertical"
android:choiceMode="singleChoice"
android:layout_height="wrap_content"
android:layout_width="200dip"
android:layout_gravity="center_horizontal"
android:scrollbarAlwaysDrawVerticalTrack="true">
</ListView>
</TableRow>
</TableLayout>
Yorumlar