グリッドビューがあります。カスタムビューを備えたシンプルなグリッドアダプターがありますが、そのカスタムビューは画像を非表示にしますが、Eclipseのグラフィカルレイアウトビューでビューを表示できます。でも実行すると画像が隠れてしまいます
custom grid item layout :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/grid_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/gridviewlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/grid_item_selector" >
<ImageView
android:id="@+id/picture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/text"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="5dp"
android:padding="5dp"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="10dp"
android:gravity="center"
android:paddingBottom="5dp"
android:singleLine="true"
android:text="settings"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/black"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
カスタムグリッドアイテムレイアウトxmlのエラーログを確認してください。出力を提供するサンプルを使用してコードを確認しました。画像が破損している可能性があります。drawable / ic_launcherファイルを確認するか、resourcesフォルダーを別の画像に置き換えて試してください。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加