I am new to android and learning. I am building form like UI and using linear layout. I have tried to put these in two vertical linear layouts inside a horizontal layout but couldn't manage to align label text elements with each input element. Below, I am using three linear layouts.
xml layout:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/linlaytop"
android:layout_marginLeft="@dimen/linlayleft"
android:layout_marginRight="@dimen/linlayleft"
android:layout_marginBottom="@dimen/linlaytop"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="@dimen/linlaytop">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/traffic"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/>
<Spinner
android:id="@+id/trafficSpinnerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/linlayleft">
</Spinner>
</LinearLayout>
<LinearLayout
android:layout_marginTop="@dimen/linlaytop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/location"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
/>
<EditText
android:id="@+id/locationTxtView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:layout_marginLeft="@dimen/linlayleft"/>
</LinearLayout>
<LinearLayout
android:layout_marginTop="@dimen/linlaytop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/date"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/>
<TextView
android:id="@+id/dateTxtView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/datetime"
android:layout_marginLeft="@dimen/linlayleft"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/>
</LinearLayout>
</LinearLayout>
I want to align these three elements:
Please advise.



I want to align these three elements- In what order? - Nongthonbam Tonthoilayout_weight- Nongthonbam Tonthoi