Make a view next to another and at the middle of its height
I'm trying to make an Activity with an NumberPicker and a TextView and I
want that the textView will be next to the NumberPicker and it will be at
the middle of NumberPicker Height (the TV going to be something like
"choose a number:") any thing I've tried didn't worked. (I even tried to
put any one in a different LinearLayout and the two LinearLayouts in a
RelativeLayout and messed with the prefences and it still didn't work)
here is what I tried:
<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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:paddingTop="30dp"
android:text="@string/Main"/>
<NumberPicker
android:id="@+id/numberPicker1"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toStartOf="@+id/textView1"
android:clickable="false"
android:paddingTop="0dp" />
</RelativeLayout>
Thanks!
No comments:
Post a Comment