How to Put a Linear Layout
<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/image_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnWidth="@dimen/button_width"
android:numColumns="auto_fit" >
</GridView>
<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/image_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnWidth="@dimen/button_width"
android:numColumns="auto_fit" >
</GridView>
And the activity has to change to use the GridView instead of ListView:
public class MyActivity extends FragmentActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.image_list);
GridView imageList = (GridView) findViewById(R.id.image_list);
final ImageStuffAdapter imageAdapter = new ImageStuffAdapter(this);
imageList.setAdapter(imageAdapter);
imageList.setBackgroundResource(R.drawable.bkg);
}
}