アンドロイドでギャラリーを作りたいのですが。アダプターを設定するには、xmlファイルで定義したギャラリーを取得する必要があります。私はそれを次のようにしています:Gallery g =(Gallery)findViewById(R.id.gallery1); しかし、このコードでは、「ビューからギャラリーにキャストできません」というエラーが表示されるため、プロジェクトをコンパイルできません。私のxmlファイルは次のようになります: "
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Gallery android:id="@+id/gallery1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
/>
</LinearLayout>
誰かが私の問題を解決する方法を知っていますか?どうもありがとう