Örnek GridView XML'i:
<?xml version="1.0" encoding="utf-8"?> <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridview" android:layout_width="match_parent" android:layout_height="match_parent" android:columnWidth="90dp" android:numColumns="auto_fit" android:verticalSpacing="10dp" android:horizontalSpacing="10dp" android:stretchMode="columnWidth" android:gravity="center" />
ArrayAdapter<String> itemsAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, words); // Find the {@link ListView} object in the view hierarchy of the {@link Activity}.// There should be a {@link ListView} with the view ID called list, which is declared in the// activity_numbers.xml layout file.GridView gridView = (GridView) findViewById(R.id.gridview); // Make the {@link ListView} use the {@link ArrayAdapter} we created above, so that the// {@link ListView} will display list items for each word in the list of words.// Do this by calling the setAdapter method on the {@link ListView} object and pass in// 1 argument, which is the {@link ArrayAdapter} with the variable name itemsAdapter.gridView.setAdapter(itemsAdapter);
SONUÇ
Hiç yorum yok:
Yorum Gönder