3

カスタムダイアログを備えたアプリに取り組んでいます。そのダイアログ内には、リスト ビューのどの項目がクリックされたかに応じて、コードで設定した画像があります。ダイアログ内のすべてが機能します。ボタンやテキストとともに画像が表示されます。ただし、使用している画像は、希望よりもはるかに小さいままです。このチュートリアルに従おうとしましたが、ある点を超えて画像を拡大することはできません。スケールダウンはしますが、アップはしません。これを修正するために、さまざまな方法を含めてさまざまな方法を試しandroid:scaleType=""ましたが、役に立ちませんでした。どんな助けでも大歓迎です。400枚を超える画像があるため、サイズを個別に設定することは避けたいと思います。一度設定してxmlで実行したいと思います。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">

<ImageView android:id="@+id/ImageView01"
 android:contentDescription="@string/desc"
 android:saveEnabled="true"
 android:adjustViewBounds="true"
 android:scaleType="fitXY"
 android:maxWidth="375dp"  
 android:maxHeight="375dp"
 android:layout_width="wrap_content" android:layout_height="wrap_content"
 android:layout_centerHorizontal="true" />

 <ScrollView android:id="@+id/ScrollView01"
 android:layout_width="wrap_content" android:layout_below="@+id/ImageView01"
 android:layout_height="wrap_content">

 <TextView android:id="@+id/TextView01"
 android:layout_width="wrap_content" android:layout_height="wrap_content"
 android:paddingLeft="5dp" />

 </ScrollView>

 <Button
 android:id="@+id/Button01"
 android:layout_width="150dp"
 android:layout_height="50dp"
 android:layout_alignParentRight="true"
 android:layout_below="@+id/ScrollView01"
 android:background="@drawable/border"
 android:text="@string/cancel"
 android:textColor="#ffffff" />

 <Button
 android:id="@+id/Button02"
 android:layout_width="150dp"
 android:layout_height="50dp"
 android:layout_below="@+id/ScrollView01"
 android:background="@drawable/border"
 android:text="@string/copy"
 android:textColor="#ffffff" />

 </RelativeLayout>
4

1 に答える 1

1

画像を/res/drawable-nodpiフォルダーに入れます (または、それに応じてコードを変更してフォルダーに入れassets/ます)。

drawable/それらの画像を他のフォルダーから削除します。寸法を教えてください。さまざまな方向のさまざまな画面でテストします。これらの画像は画面の幅全体を占めるため、さまざまなサイズのバケットに合わせてレイアウトを調整する必要があるかもしれませんが、さまざまな密度のバケットに対してそれを行う必要があるとは思えません。

于 2013-07-09T02:44:58.883 に答える