画像の縦横比を処理する正しいクリーンな方法は何ですか?
私のアプリでは、画面を回転させると縦横比が失われ、画像が地獄のように醜く見えます - 私のアプリと Play ストアを比較したこれらの画像を参照してください - http://imgur.com/a/GriwP#0
これが私がやっている方法です:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_gravity="center" >
<Button
android:id="@+id/btnStark"
android:layout_marginLeft="4dp"
android:layout_marginRight="2dp"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_weight="1"
android:background="@drawable/stark"
android:gravity="center|bottom"
android:layout_gravity="top" />
<Button
android:id="@+id/btnLannister"
android:layout_marginLeft="2dp"
android:layout_marginRight="4dp"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_weight="1"
android:background="@drawable/stark"
android:gravity="center|bottom"
android:layout_gravity="top" />
</LinearLayout>
高さはどのように処理すればよいですか?固定値を設定する必要がありますか? または、アスペクト比を自動的に維持する方法はありますか?
私が使用している画像は400x300ピクセルです