3

我正在尝试使用 android.widget.NumberPicker 但将范围限制为 0 - 5。但是,这似乎导致我的应用程序锁定。最初,向上/向下按钮不可用,突出显示该框会出现一个,但按几次会导致应用程序停止响应。

    final NumberPicker numerOnePicker  = (NumberPicker) findViewById(R.id.numericOnePicker);    
    numerOnePicker.setMinValue(0);
    numerOnePicker.setMaxValue(4);  

XML如下:

<LinearLayout android:layout_height="wrap_content" 
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"   
android:orientation="horizontal"
android:paddingTop="20dp"> 

<NumberPicker
        android:id="@+id/numericOnePicker"
        android:layout_width="55dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:orientation="vertical"/>
4

0 回答 0