I like to work with combination of LinearLayout, especially when creating forms.
<LinearLayout 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:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
android:id="@+id/spinnerLayout"
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/select_conversion"
android:layout_weight="40" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/conversionSelectorSpinner"
android:layout_weight="60" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:text="@string/enter_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="40" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="8"
android:id="@+id/valueEntered"
android:onClick="onClickEnterValue"
android:text=""
android:layout_gravity="center_vertical"
android:layout_weight="60" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="30dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:text="@string/resulting_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="40" />
<TextView
android:id="@+id/resultingValue"
android:text="..."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="60" />
</LinearLayout>
</LinearLayout>
No comments:
Post a Comment