The error "Invalid layout param in a LinearLayout: layout_alignParentTop
or layout_centerHorizontal or layout_centerVertical or
layout_alignParentLeft" occurs when you have declared the Linear Layout
but included these layout parameters for the button, textview or any
other layout element.
Removing these attribute such as "alignParentTop" declared for any of the layout element such as textview or button will resolve the error.
For an example you may get above error if you have declared linear layout as below:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android "
xmlns:tools="http://schemas.android.com/tools "
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="34dp"
android:layout_marginTop="61dp"
android:text="@string/hello_world" />
</LinearLayout>
xmlns:tools="http://schemas.
android:layout_width="match_
android:layout_height="match_
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_
android:layout_height="wrap_
android:layout_
android:layout_alignParentTop=
android:layout_marginLeft="
android:layout_marginTop="
android:text="@string/hello_
</LinearLayout>
To resolve the error remove lines marked in red.
sweet:-) saved me a lot of frustration for sharing
ReplyDelete