LinearLayout を GridView に追加しようとしていますが、問題が発生しています。基本的に、私はその下に画像がある一連のアイコンを作成しようとしています。(Launcher.app のような)
私が見ているのは、GridView が表示されたときに小さなアイコンに分割されていないことです。代わりに、すべてのアイコンが独自の行に表示されます。関連ファイルと以下のコード:
私のアダプター:
@Override public View getView(int position, View convertView, ViewGroup parent) {
LinearLayout llView;
ImageView imageView;
TextView textView;
if (convertView == null) { // if it's not recycled, initialize some attributes
LayoutInflater inflater = FolderSelectionActivity.this.getLayoutInflater();
llView = (LinearLayout) inflater.inflate(R.layout.folder_view, null);
} else {
llView = (LinearLayout) convertView;
}
imageView = (ImageView) llView.findViewById(R.id.folder_image_view);
textView = (TextView) llView.findViewById(R.id.folder_text_view);
imageView.setImageBitmap(mDrive.getPreview(mFiles.get(position)));
textView.setText(mFiles.get(position).getTitle());
return llView;
私のビューのxml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#FF0000FF"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView android:id="@+id/folder_image_view"
android:scaleType="centerCrop"
android:background="#FFFF0000"
android:layout_width="100px"
android:layout_height="100px"/>
<TextView android:id="@+id/folder_text_view"
android:background="#FF00FF00"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
そして最後に、私のアクティビティのレイアウト:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<GridView android:id="@+id/folder_grid_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</RelativeLayout>
LinearLayout にあらゆる種類の微調整を試みましたが、機能するものが見つからないようです。ここで何をすべきか知っている人はいますか?
編集:
imgur スクリーンショット: http://imgur.com/PsSvW