Androidで画像を扱うのは本当に難しいと思います.Android開発の最も難しい部分だと思います...
1)私は画像を持っています。それをアプリケーションの背景にしたいので、そうします
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainActivity"
android:background="@drawable/accueil">
</RelativeLayout>
背景は画面全体を埋める必要がありますが、cas ではありません。一部の (小さい) 画面では、背景の一部のみが表示されます。どのように言うことができますか: 画像が画面よりも大きい場合でも、画像を画面全体に表示したいので、背景がすべて見えるように画像を縮小する必要がありますか?
背景として使用する代わりに、背景を配置する必要があるかもしれません
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainActivity">
<ImageView
android:id="@+id/imageView1"
android:layout_width="500dp"
android:layout_height="500dp"
android:adjustViewBounds="false"
android:src="@drawable/accueil" />
</RelativeLayout>
ただし、一部のデバイスでは、画像が少しトリミングされています。
2) レイアウトを別のレイアウトに配置する必要がありますが、その位置を正確にし、その幅を親レイアウトに相対的にする必要があります。それでも私がするなら
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/fond">
<LinearLayout
android:layout_width="300dp"
android:layout_height="350dp"
android:layout_marginTop="20dp"
android:background="@drawable/fondshare"
android:orientation="vertical" >
結果が私が期待したものではないことがわかります(線形レイアウトはスマイリーとすべてのボタンのある長方形です)