0
main.xml
<LinearLayout
android:id="@+id/spinners"
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal">
<Spinner
android:id="@+id/location_spinner"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:dropDownWidth="match_parent"/>
<Spinner
android:id="@+id/license_spinner"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:dropDownWidth="match_parent"/>
</LinearLayout>
spinner_row.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<Button
android:id="@+id/btn_1"
style="@style/SpinnerButton">
</Button>
</LinearLayout>
style.xml
<style name="SpinnerButton" parent="@android:style/Widget.Button">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginLeft">5dp</item>
<item name="android:layout_marginRight">5dp</item>
<item name="android:layout_marginBottom">10dp</item>
<item name="android:textColor">@android:color/black</item>
<item name="android:layout_weight">1</item>
<item name="android:clickable">true</item>
</style>
私は[画像B]のようなスタイルをドロップダウンします。私はdropDownWidth = match_parent
を使用しました。しかし、それは動作しません。私はこのdropDownの親がSpinnerだと思う。各スピンナーには1のウェイトがあります。ワイドドロップレイアウトを適用する方法はありますか?
てみてくださいポップアップメニューの代わりにスピナーの、このリンクをご確認くださいhttp://stackoverflow.com/questions/38477208/set-popup-menu-to-full-screen – Sach
@サチンShelar >>感謝。私はあなたと@Android開発者が同じ方法をお勧めしますと思う。右? – 01hanst
[Spinner DropDownの幅を変更する]の複製があります(http://stackoverflow.com/questions/18235711/change-spinner-dropdown-width) –