Problems with LinearLayout, views aren't resembling the preview in
Graphical Layout on device
So I'm having a problem that is driving me crazy. Knowing the purpose of
my app isn't important/relevant so I'll just paste my code from the xml
file. The layout is a RelativeLayout, but the problem I'm having is inside
of this LinearLayout. Code:
<LinearLayout
android:id="@+id/some_stuff"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="horizontal"
>
<EditText
android:id="@+id/edit_text"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="What's your question?"
android:imeOptions="actionDone"
android:inputType="textCapSentences|textAutoComplete"
android:textSize="25sp"
android:layout_gravity="left"
android:textStyle="bold" />
<ImageButton
android:id="@+id/imagebutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dip"
android:layout_weight="0"
android:layout_gravity="right"
android:background="@drawable/my_image_button"
/>
</LinearLayout>
Again, this is nested inside of the parent, RelativeLayout. In the
preview, when clicking on the "Graphical Layout" tab, this looks like
exactly what I want; EditText to the left of a small ImageButton, with
correct proportions and margins. However, when I run this on my device,
the LinearLayout is REVERSED, meaning now that the EditText is to the
RIGHT of the ImageButton. Does anyone know what is going wrong here?
Note: I've already cleaned and refreshed my project; this was ineffective.
I've also tried removing the layout_gravity attributes, and that did
nothing.
Thanks
No comments:
Post a Comment