2つのスピナーを隣に置くと、この問題が発生します。ここではレイアウトXMLのフラグメントである:隣り合う2つのスピナー
...
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2" >
<Spinner
android:id="@+id/x"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:layout_weight="1" />
<Spinner
android:id="@+id/y"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:layout_weight="1" />
</LinearLayout>
<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
<ListView
android:id="@+id/z"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="#FFFFFF" >
</ListView>
...
...
ここでの結果である:
私は、多くの異なるものを試してみました。私は重力、重力、親をRelativeLayoutに変更しようとしましたが、結果は変わりません。
助けてください!
編集:
わかった。いくつかの冗長性が、問題を解決します。なぜこれが動作し、 "正常な方法"はありませんかわいい奇妙な。みんな助けてくれてありがとう。
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2" >
<Spinner
android:id="@+id/x"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" />
<RelativeLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1" >
<Spinner
android:id="@+id/y"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
</RelativeLayout>
</LinearLayout>
問題を再現できません。次のようにアンドロイド:layout_gravity = "center_vertical"をスピナーに追加しました。お互いに隣り合う2つのスピナーを除いてすべてを剥がそうとしましたか?ルートと2つのスピナーのLinearLayoutは1つだけですか?また、Eclipseのプレビューと実際のデバイス/エミュレータでこの問題が発生していますか? –