1

水平モードで数値ピッカーを作成したいのですが、android:orientation="horizo​​ntal" を設定してもまだ機能しません。下の写真のように、水平モードでナンバーピッカーを作成するにはどうすればよいですか?

ここに画像の説明を入力

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
                tools:context="com.example.sam.weighttrack.KeyInWeightF">

    <LinearLayout
        android:id="@+id/payment2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal" >

        <NumberPicker
            android:id="@+id/numberPicker1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal" />
    </LinearLayout>
</RelativeLayout>
4

1 に答える 1

2

NumberPicker横向きはサポートしていません。そのため、独自に作成するか、既存のいくつかのライブラリのいずれかを使用する必要があります。

  1. 水平ピッカー
  2. アンドロイド-スピナーホイール
于 2015-12-06T14:57:11.233 に答える