When I add android:background="@drawable/bg"
to my code, it causes the program to crash. When i remove it however, it works fine. What is wrong? I have even tried the layout.setBackground()
and layout.setBackgroundDrawable()
ways and they all cause the program to crash.
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/bg" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/bg" android:orientation="vertical"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <LinearLayout android:id="@+id/linearlayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:orientation="vertical"> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/textView2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:gravity="center_vertical|center_horizontal" android:text="inScope" android:textSize="30dp" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0" android:orientation="vertical"> <EditText android:id="@+id/emailfield" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_weight="0" android:background="@android:color/transparent" android:hint="Email" /> <EditText android:id="@+id/passwordfield" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_weight="0" android:background="@android:color/transparent" android:ems="10" android:hint="Password" android:inputType="textPassword" android:paddingTop="20dp" /> </LinearLayout> </LinearLayout> <LinearLayout android:id="@+id/linearlayout2" android:layout_width="fill_parent" android:layout_height="226dp" android:orientation="horizontal"> <Button android:id="@+id/login" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:singleLine="false" android:text="Login" android:theme="@style/Base.Widget.AppCompat.Button.Borderless" /> <Button android:id="@+id/register" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="Register" android:theme="@style/Base.Widget.AppCompat.Button.Borderless" /> </LinearLayout> </LinearLayout> </LinearLayout>
No comments:
Post a Comment