Reputation: 373
In my layout I have four blocks like these:
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/label1"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="@string/freq_1_50" />
<ProgressBar android:id="@+id/progress_horizontal1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:max="100"
android:progress="50" />
<EditText
android:id="@+id/textScore1"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:focusable="false"
android:focusableInTouchMode="false"
android:inputType="none"
android:text="50%" />
</LinearLayout>
Resulting in this picture in the android emulator:
The obvious questions is: how do I go about in vertically aligning the EditText and progressbar?
Thanks in advance!
Here is the desired result of adding the center attribute:
Problem solved!
Upvotes: 0
Views: 1632
Reputation: 1267
Try
<LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"
android:gravity = "center">
<EditText
android:id="@+id/label1"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="@string/freq_1_50" />
<ProgressBar android:id="@+id/progress_horizontal1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:max="100"
android:progress="50" />
<EditText
android:id="@+id/textScore1"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:focusable="false"
android:focusableInTouchMode="false"
android:inputType="none"
android:text="50%" />
Upvotes: 2
Reputation: 1521
Just add android:gravity = "center"
to your Linear layout above
Upvotes: 0