I have a layout which has title on the top 2 buttons at the bottom and some text views and Edit text in between. I am willing to put these EditText and Text views in scroll view so that I can scroll and EditText does not hide behind keyboard.
Here is my XML file, I am sorry its bit lengthy, but pls, look into this and let me know what is wrong int this. I always get
java.lang.RuntimeException: Binary XML file line #73: You must supply a layout_width attribute.
I have tried changing width and height lot of ways but i always get this error.
XML File
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center_horizontal">
<!-- Title(Preview) Background and Text-->
<RelativeLayout
android:id="@+id/previewBG"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/title_bg">
<TextView
android:id="@+id/previewTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/addDevicesTittle"
android:textSize="24sp"
android:typeface="sans"
android:textColor="#ffffff"
android:layout_centerInParent="true"
>
</TextView>
</RelativeLayout>
<!-- Title(Preview) Background and Text End -->
<!-- Buttons -->
<LinearLayout
android:id="@+id/Buttons"
android:layout_width="fill_parent"
android:layout_height="60dip"
android:layout_alignParentBottom="true"
android:background="@color/COL_BTNBG">
<LinearLayout
android:id="@+id/btnRefresh_part"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="6dip">
<Button
android:id="@+id/btnSave"
android:layout_width="fill_parent"
android:layout_height="49dip"
android:text="@string/btn_manual_save"
android:textSize="24sp"
android:typeface="sans"
android:textColor="@color/COL_WHITE"
android:layout_weight ="1"
android:background="@+drawable/button_02"
>
</Button>
<Button
android:id="@+id/btnCancel"
android:layout_width="fill_parent"
android:layout_height="49dip"
android:text="@string/btn_manual_cancel"
android:textSize="24sp"
android:typeface="sans"
android:textColor="@color/COL_WHITE"
android:layout_weight ="1"
android:background="@+drawable/button_02"
>
</Button>
</LinearLayout>
</LinearLayout>
<!-- Buttons End -->
<ScrollView
android:id="@+id/scrollView"
android.layout_width="50dip"
android.layout_height="300dip"
android:layout_below="@+id/previewBG"
>
<RelativeLayout
android:id="@+id/Data"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:isScrollContainer="true">
<TextView
android:id="@+id/domain_view"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/txtDomain"
android:gravity="left"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_alignParentTop = "true"
android:layout_marginTop="10dip"/>
<EditText
android:id="@+id/domain_edit"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:scrollHorizontally="true"
android:singleLine ="true"
android:autoText="false"
android:hint ="@string/txtDomainExample"
android:capitalize="none"
android:gravity="fill_horizontal"
android:layout_below = "@+id/domain_view"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/ip_view"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/manual_IP"
android:gravity="left"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_below = "@+id/domain_edit"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_marginTop="10dip"/>
<EditText
android:id="@+id/ip_edit"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:scrollHorizontally="true"
android:singleLine ="true"
android:autoText="false"
android:hint ="@string/enter_IP_address"
android:capitalize="none"
android:gravity="fill_horizontal"
android:layout_below = "@+id/ip_view"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/user_view"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/txtUserName"
android:gravity="left"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_below = "@+id/ip_edit"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_marginTop="10dip"/>
<EditText
android:id="@+id/user_edit"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:scrollHorizontally="true"
android:hint ="@string/txtUserNameExample"
android:singleLine ="true"
android:autoText="false"
android:capitalize="none"
android:gravity="fill_horizontal"
android:layout_below = "@+id/user_view"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/password_view"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/txtPassword"
android:gravity="left"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_below = "@+id/user_edit"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_marginTop="10dip"/>
<EditText
android:id="@+id/password_edit"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:scrollHorizontally="true"
android:hint ="@string/txtPasswordExample"
android:singleLine ="true"
android:autoText="false"
android:capitalize="none"
android:gravity="fill_horizontal"
android:password = "true"
android:layout_below = "@+id/password_view"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
Your ScrollView has android.layout_width instead of android:layout_width ... similarly layout_height
Observe the dot instead of the colon
That could be your problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With