Saturday, 24 August 2013

When I changed my parent layout from linear to frame or relative it gives me error

When I changed my parent layout from linear to frame or relative it gives
me error

On my previous xml code my app was running correctly:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="82dp" >
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/button1"
android:ems="10" >
<requestFocus />
</EditText>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="Send" />
</RelativeLayout>
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="380dp" />
</LinearLayout>
Now when I changed my xml ,and now when I make relative layout or frame
layout as a parent my app gives me error "unfortunately it is stopped", My
new xml is:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="86dp"
android:layout_gravity="bottom" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="Send" />
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/button1"
android:ems="10" />
</RelativeLayout>
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="372dp" >
</ListView>
</FrameLayout>
Logcat:
08-24 19:08:24.050: E/AndroidRuntime(674): at
android.app.FragmentManagerImpl.moveToState(FragmentManager.java:809)
08-24 19:08:24.050: E/AndroidRuntime(674): at
android.app.FragmentManagerImpl.moveToState(FragmentManager.java:998)
08-24 19:08:24.050: E/AndroidRuntime(674): at
android.app.BackStackRecord.run(BackStackRecord.java:622) 08-24
19:08:24.050: E/AndroidRuntime(674): at
android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1330)
08-24 19:08:24.050: E/AndroidRuntime(674): at
android.app.Activity.performStart(Activity.java:4474) 08-24 19:08:24.050:
E/AndroidRuntime(674): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1928)
08-24 19:08:24.050: E/AndroidRuntime(674): ... 11 more

No comments:

Post a Comment