我必须让 NumberPicker 让用户在 0 - 4 之间进行选择,但不是每次都增加一...
我需要将它增加 0.05,例如 (0.05 - 0.1 - 0.15 - .... - 3.95 - 4)
以及哪些属性使 numberpicker 在设计中看起来不错 在此
先感谢
main_xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
android:orientation="vertical">
<NumberPicker
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/pick">
</NumberPicker>
</LinearLayout>
MainActivity.java
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.NumberPicker;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_grades_scale);
NumberPicker numberPicker=(NumberPicker)findViewById(R.id.pick);
numberPicker.setMinValue(0);
numberPicker.setMaxValue(4);
numberPicker.setWrapSelectorWheel(false);
}
}