java 在水平模式下创建一个数字选择器,android:orientation="horizontal" 工作了吗?我试过了,但数字选择器在垂直模式下仍然相同
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34118359/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Create a number picker in horizontal mode, did android:orientation="horizontal" work? I have try but the number picker still same in vertical mode
提问by Wg Sam
I want to create a number picker in horizontal mode, but i set the android:orientation="horizontal", it still cannot work. How can i create the number picker in horizontal mode just like the pic below ?
我想在水平模式下创建一个数字选择器,但我设置了 android:orientation="horizontal",它仍然无法工作。我怎样才能像下面的图片一样在水平模式下创建数字选择器?
<?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>
回答by
NumberPicker
does not support horizontal orientation. So you have to write your own or use one of few existed libraries:
NumberPicker
不支持水平方向。因此,您必须自己编写或使用少数现有库之一: