In my RelativeLayout I am trying to put two buttons in the second half of the screen,
below a line, which I create using a View.
But the buttons will not show below the line (view1
)
This is my my XML:
<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="wrap_content"
android:background="@drawable/bgland"
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=".MenuActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:scaleType="fitXY"
android:src="@drawable/white_bg" />
<EditText
android:id="@+id/bikenumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/getbikebutton"
android:layout_centerHorizontal="true"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_marginTop="20dip"
android:ems="10"
android:hint="@string/hint_getbike"
android:inputType="number"
android:singleLine="true" >
<requestFocus />
</EditText>
<Button
android:id="@+id/getbikebutton"
style="@style/OrangeButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/view1"
android:layout_alignLeft="@+id/view1"
android:layout_alignRight="@+id/view1"
android:layout_marginBottom="10dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:text="@string/menu_getbikebuttontext" />
<View
android:id="@+id/view1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_centerInParent="true"
android:layout_margin="20dip"
android:background="@android:color/darker_gray" />
<Button
android:id="@+id/buttonGoToMyLoc"
style="@style/OrangeButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/view1"
android:layout_alignRight="@+id/view1"
android:layout_below="@+id/view1"
android:layout_marginBottom="10dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:text="@string/menu_text_near_me" />
<Button
android:id="@+id/buttonGoToThisLoc"
style="@style/OrangeButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/view1"
android:layout_alignRight="@+id/view1"
android:layout_below="@+id/buttonGoToMyLoc"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:layout_marginTop="10dip"
android:text="@string/menu_text_address" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="25dip"
android:text="@string/menu_title"
android:textColor="@android:color/black"
android:textSize="20dip"
android:textStyle="bold" />
<EditText
android:id="@+id/locAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/imageView1"
android:layout_alignRight="@+id/imageView1"
android:layout_below="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_marginTop="10dip"
android:ems="10"
android:hint="@string/menu_hint"
android:inputType="text"
android:singleLine="true"
android:visibility="gone" >
<requestFocus />
</EditText>
<EditText
android:id="@+id/locAddressCity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/imageView1"
android:layout_alignRight="@+id/imageView1"
android:layout_below="@+id/locAddress"
android:layout_centerHorizontal="true"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:ems="10"
android:hint="@string/menu_hint_city"
android:inputType="text"
android:singleLine="true"
android:visibility="gone" />
</RelativeLayout>
This is the graphical result: as you can see the 2 buttons are above (and not below, as they should) the middle line (view1
).