Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You need to add this lines to your TextViews:</p> <pre><code>android:layout_alignLeft="@id/npicker_minutes" android:layout_alignRight="@id/npicker_minutes" android:gravity="center_horizontal" </code></pre> <p>Complete sample of your code:</p> <pre><code>&lt;!-- center picker @ minutes --&gt; &lt;NumberPicker android:id="@+id/npicker_minutes" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" /&gt; &lt;!-- left picker @ hours --&gt; &lt;NumberPicker android:id="@+id/npicker_hours" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toLeftOf="@id/npicker_minutes" /&gt; &lt;!-- right picker @ seconds --&gt; &lt;NumberPicker android:id="@+id/npicker_seconds" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toRightOf="@id/npicker_minutes" /&gt; &lt;TextView android:id="@+id/tv_minutes" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@id/npicker_minutes" android:layout_alignRight="@id/npicker_minutes" android:gravity="center_horizontal" android:layout_below="@id/npicker_minutes" android:layout_marginTop="20dp" android:paddingBottom="15dp" android:text="@string/minutes_short" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/npicker_hours" android:layout_alignRight="@+id/npicker_hours" android:gravity="center_horizontal" android:layout_below="@id/npicker_hours" android:layout_marginTop="20dp" android:paddingBottom="15dp" android:text="@string/hours_short" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@id/npicker_seconds" android:layout_alignRight="@id/npicker_seconds" android:gravity="center_horizontal" android:layout_below="@id/npicker_seconds" android:layout_marginTop="20dp" android:paddingBottom="15dp" android:text="@string/seconds_short" /&gt; </code></pre> <p>The alternative way is to use tree LinearLayouts, every with one NumberPicker and one TextView inside.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload