Как правильно выровнять цифры в NumberPicker на андроиде?
Я добавил два NumberPickers в AlertDialog.Builder. Я попытался сделать текст NumberPicker выровненным вправо. Но я не мог.!
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/TextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="@string/minimum_value"
android:textSize="13sp" />
<NumberPicker
android:id="@+id/numberPicker1"
android:layout_width="match_parent"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"/>
</RelativeLayout>
1 ответ
I could not align it right. But i made some tricky work. My code is below..
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<NumberPicker
android:id="@+id/numberPicker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:alpha="1"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:paddingLeft="500dp"
android:textColor="@android:color/transparent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/numberPicker"
android:layout_alignLeft="@+id/numberPicker"
android:layout_alignRight="@+id/numberPicker"
android:layout_alignTop="@+id/numberPicker"
android:clickable="true" />
<TextView
android:id="@+id/TextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/numberPicker1"
android:paddingLeft="10dp"
android:text="@string/minimum_value"
android:textSize="18sp" />
<NumberPicker
android:id="@+id/numberPicker1"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:fadingEdge="none" />
</RelativeLayout>