この画像http://postimg.org/image/h8akuq9gz/は、私が何を望んでいるかのアイデアを提供するはずです。デバイスが垂直または水平の位置にあるかどうかに関係なく、この 2 つの「円」は常に中央にある必要があります。
どうすればこれを達成できるか本当にわかりません。方向を教えてもらえますか?ありがとう!
この画像http://postimg.org/image/h8akuq9gz/は、私が何を望んでいるかのアイデアを提供するはずです。デバイスが垂直または水平の位置にあるかどうかに関係なく、この 2 つの「円」は常に中央にある必要があります。
どうすればこれを達成できるか本当にわかりません。方向を教えてもらえますか?ありがとう!
次のように、ルート レイアウトで重力を使用しない理由は次のとおりです。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:gravity="center_vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:layout_height="wrap_content"
android:layout_width="fill_parent"/>
<Button
android:layout_height="wrap_content"
android:layout_width="fill_parent"/>
</LinearLayout>
これを試すことができますか: 例は画像ボタン用ですが、必要に応じて試すことができます
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/RelativeLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageButton android:id="@+id/btnFindMe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/findme"></ImageButton>
</RelativeLayout>
使用する
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
gravity="center">
<--Other contorls you want to keep in center-->
</RelativeLayout>