プログラムの上部に2つのボタンを配置して、ユーザーをさまざまなアクティビティに誘導したいと思います。フォーマットに問題があります。
画面サイズに応じてボタンが比例して伸びるようにするにはどうすればよいですか?今のところ、1つの画面サイズで問題ないように見えます。次に別の画面サイズに切り替えると、すべてがつぶれたり、引き伸ばされたりして表示されます。さまざまなScaleTypeをすべて試しましたが、違いはないようです。私も行って、Shubhayuの答えを使用して、すべての画像を正しいサイズに比例して保存しました。
これまでの私のコードは次のとおりです。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/brushed_metal_background_dark"
tools:context=".HomeActivity" >
<ImageButton
android:id="@+id/incidentsSelect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/incident_bar2"
android:contentDescription="Incidents"
android:onClick="chooseIncident"
android:scaleType="center" />
<ImageButton
android:id="@+id/operationalPeriodsSelect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/operationalperiod_bar2"
android:contentDescription="Operational Periods"
android:onClick="chooseOperationalPeriod"
android:scaleType="fitCenter" />