0
Android Wearアクティビティにわずかに異なる4つのImageViewのグリッドをレイアウトしていて、グリッドセル内に収まるようにスケーリングされたImageViews 。Android Wearに均等に配置されたグリッドを配置する方が良い
私はこれを、両端にバッファーカラムを入れて中央に押し込む(ラウンドウォッチのエッジでクリッピングを避けるため)と、バッファーゾーンを押してプッシュする特定のラウンドウォッチでは "顎"の上の細胞。これは正常に動作しますが、私は通常ネストされた線形レイアウトを避けようとします。より良い方法がありますか?ここで
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/goal_strip"
android:orientation="vertical">
<LinearLayout
android:id="@+id/goal_actions"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:visibility="gone"
android:layout_weight="1">
<FrameLayout
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="0.2"/>
<ImageView
android:id="@+id/cancel_goal"
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="0.8"
android:layout_gravity="center"
android:scaleType="fitCenter"
android:scaleX="0.8"
android:scaleY="0.8"
android:textColor="@color/black"
android:src="@drawable/minus_light"/>
<ImageView
android:id="@+id/add_goal"
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="0.8"
android:layout_gravity="center"
android:textColor="@color/black"
android:src="@drawable/ic_add_circle_white_24dp"/>
<FrameLayout
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="0.2"/>
</LinearLayout>
<LinearLayout
android:id="@+id/cards"
android:layout_width="match_parent"
android:layout_height="0dp"
android:visibility="gone"
android:orientation="horizontal"
android:layout_weight="1">
<FrameLayout
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="0.2"/>
<ImageView
android:id="@+id/yellow_card"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.8"
android:layout_gravity="center"
android:textColor="@color/black"
android:src="@drawable/yellow_card"/>
<ImageView
android:id="@+id/red_card"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="0.8"
android:layout_gravity="center"
android:textColor="@color/black"
android:src="@drawable/red_card"/>
<FrameLayout
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="0.2"/>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.1"/>
</LinearLayout>
私は本当にFrameLayoutsが嫌いですが、%マージンを行う方法は他にありませんでした。問題は、腕時計の顔にはさまざまなサイズがあり、40dpは大きな腕時計ではすばらしく、小さな腕時計には絶対に窮屈に見えることです。しかし、私はアイデアを公開しています。 – Opus1217
私はdimens.xmlにマージンを定義し、エミュレータを使用してそれぞれの密度バケットに適切な値を見つけます。それはもう少し仕事ですが、私の意見ではより良い解決策です。 – TofferJ