Android : adding android:background="#9AED7B" changing button height

on Friday, December 5, 2014


I am new to Android development.


Below is the code I am using.



<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#6C70EB"
android:padding="10sp"
>
<TextView android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="URL:"
android:layout_alignBaseline="@+id/entry"
android:layout_alignParentLeft="true"/>
<EditText
android:id="@id/entry"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/label"
android:layout_alignParentTop="true"
android:text="http://www..com"

/>
<Button
android:id="@+id/ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/entry"
android:layout_alignRight="@id/entry"
android:shadowColor="@android:color/transparent"
android:text="Ok"
android:onClick="openFB"

/>
<Button
android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/ok"
android:layout_alignTop="@id/ok"
android:onClick="resetURL"
android:shadowColor="@android:color/transparent"
android:text="Cancel" />
</RelativeLayout>


This gives me output as below.


Now when I add android:background="#9AED7B" in Ok button, it looks like below.


Any idea why height of the Ok button changed after adding background color to it?


0 comments:

Post a Comment