スタイルの画像背景のサイズを変更したいのですが、スタイルを使用して背景画像を表示する画像ビューがあります
スタイル:
<style name="Background">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">50dp</item>
<item name="android:orientation">horizontal</item>
<item name="android:background">@drawable/img_background</item>
</style>
だから私は "img_background" を持っていて、そのサイズは約 1920*1080 です。すべてのデバイスのサイズに合うように完璧にサイズを変更したいです。画面のサイズに応じて自動的にサイズを変更するにはどうすればよいですか?画像が適切に表示されず、画面に合わせて適切にサイズ変更されていません。
スタイルを持ち、その中に Image ビューを持つ LinearLayout があります。1920*1080 に適切に適合しません。たとえば、800*480 の解像度ではトリミングされ、きちんとサイズ変更されません。
<LinearLayout
style="@style/Background"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<ImageView
android:contentDescription="@null"
android:layout_marginBottom="8dip"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dip"
android:layout_marginTop="8dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="false"
android:paddingLeft="15dip"
android:src="@drawable/img_background"
/>
</LinearLayout>
ありがとう