2017-12-14 6 views
1

私はAndroid Asset Studioで画像を作成しました。これは、drawable-hdpi、drawable-mdpi、drawable-xhdpi、drawable-xxhdpi、drawable-xxxhdpiの各フォルダを含むzipファイルを与えました。各フォルダには、 。私はこれらのフォルダを私のアンドロイドプロジェクトのResources/drawableフォルダに貼り付けました。次に、私は作成しました:ImageViewをXamarin.Androidアプリケーションに配置する方法デバイスの画面サイズに応じてサイズを変更しますか?

<ImageView 
    android:src="@android:drawable/ic_ac_unit" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/imageView1" /> 

しかし何も画面に表示されません。 Googleではたくさんの例がありますが、Xamarin.Androidを使用してフォローしたときに動作しないため、Android搭載のJava用です。

+0

[this](https://developer.xamarin.com/guides/android/application_fundamentals/resources_in_android/part_3_-_alternate_resources/Images/alternate-resources-vs.png) - [画像ソース]([ https://developer.xamarin.com/guides/android/application_fundamentals/resources_in_android/part_3_-_alternate_resources/) – Mohamed

答えて

0

だから私はあなたの問題はあなたのImageViewのの画像は、Androidのシステムからのものであることだと思う、次のことを試してください。

<ImageView 
    android:src="@drawable/ic_ac_unit" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/imageView1" /> 

これを修正する必要があります。あなたが気づいたように、私はandroid:srcを変更しました。あなたが持っていた値は以下のとおりであった:

アンドロイド:SRC = "@アンドロイド:描画可能/ ic_ac_unit"

そして、それは、Android OSの定義済みのDrawableから名前 "ic_ac_unit" で描画可能を取得しようとしていますあなたのドロウアブルからではありません。それは私が見ている問題です。

また、Android Asset Studioで作成された「ドロワブル解像度」のフォルダは、リソース/ドロワブルフォルダ内ではなく、プロジェクトの「リソース」フォルダに直接貼り付ける必要があります。

関連する問題