Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9169245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:49:44+00:00 2026-06-17T15:49:44+00:00

Hoping this is a simple one. I have a layout that uses a scrollview.

  • 0

Hoping this is a simple one.

I have a layout that uses a scrollview. This was fine until I wanted to put an image and textview above it then have the scrollview with my edittexts below it.

At the moment I’m getting the following errors:

01-22 20:13:32.228: E/AndroidRuntime(275): FATAL EXCEPTION: main
01-22 20:13:32.228: E/AndroidRuntime(275): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.flybase2/com.example.flybase2.addAppointment}: java.lang.RuntimeException: Binary XML file line #26: You must supply a layout_width attribute.

I have tried to change the scroll views width attribute (which i believe that error is pointing too) with no luck.

Here’s my XML. Can anyone see what I’m doing wrong?:

<?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" >
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="84dp"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/imgLink"
        android:layout_width="78dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:src="@drawable/viewcon" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="match_parent"
        android:layout_height="75dp"
        android:gravity="center"
        android:text="Appointments"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="35sp" />
</LinearLayout>

\\ERROR: On width attribute
<ScrollView
    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:text="Name:"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
    android:id="@+id/inputAppName"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ems="10" >

    <requestFocus />
</EditText>

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Appointment Type:"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<Spinner
    android:id="@+id/spinner1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

<TextView
    android:id="@+id/textView3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Appointment Time:"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<TimePicker
    android:id="@+id/timePicker1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

<TextView
    android:id="@+id/textView4"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Appointment Time:"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<DatePicker
    android:id="@+id/datePicker1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

<TextView
    android:id="@+id/textView5"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Comments:"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
    android:id="@+id/inputAppCom"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ems="10" />

<TextView
    android:id="@+id/textView6"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Set Appointment Date Alarm:"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<ToggleButton
    android:id="@+id/toggleButton1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="ToggleButton"
    android:textOff="Alarm Off"
    android:textOn="Alarm On" />

<TextView
    android:id="@+id/textView7"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Add Appointment"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<Button
    android:id="@+id/btnAddAppointment"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Add" />

</ScrollView>
</LinearLayout>

EDIT:

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:49:44+00:00Added an answer on June 17, 2026 at 3:49 pm

    You can only set one child layout to a ScrollView. I don’t know why it’s showing you that you didn’t set android:layout_width attribute, but your problem is definitely that you have multiple child views in your ScrollView.

    <?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" >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="84dp"
        android:orientation="horizontal" >
    
        <ImageView
            android:id="@+id/imgLink"
            android:layout_width="78dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:src="@drawable/viewcon" />
    
        <TextView
            android:id="@+id/textView1"
            android:layout_width="match_parent"
            android:layout_height="75dp"
            android:gravity="center"
            android:text="Appointments"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textSize="35sp" />
    </LinearLayout>
    
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >
    
    
    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Name:"
        android:textAppearance="?android:attr/textAppearanceMedium" />
    
    <EditText
        android:id="@+id/inputAppName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10" >
    
        <requestFocus />
    </EditText>
    
    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Appointment Type:"
        android:textAppearance="?android:attr/textAppearanceMedium" />
    
    <Spinner
        android:id="@+id/spinner1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    
    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Appointment Time:"
        android:textAppearance="?android:attr/textAppearanceMedium" />
    
    <TimePicker
        android:id="@+id/timePicker1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    
    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Appointment Time:"
        android:textAppearance="?android:attr/textAppearanceMedium" />
    
    <DatePicker
        android:id="@+id/datePicker1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    
    <TextView
        android:id="@+id/textView5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Comments:"
        android:textAppearance="?android:attr/textAppearanceMedium" />
    
    <EditText
        android:id="@+id/inputAppCom"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10" />
    
    <TextView
        android:id="@+id/textView6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Set Appointment Date Alarm:"
        android:textAppearance="?android:attr/textAppearanceMedium" />
    
    <ToggleButton
        android:id="@+id/toggleButton1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="ToggleButton"
        android:textOff="Alarm Off"
        android:textOn="Alarm On" />
    
    <TextView
        android:id="@+id/textView7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Add Appointment"
        android:textAppearance="?android:attr/textAppearanceMedium" />
    
    <Button
        android:id="@+id/btnAddAppointment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Add" />
    
     </LinearLayout>
     </ScrollView>
     </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am hoping that this will have a pretty quick and simple answer. I
I have posted this question on the Ext-GWT forums, I am just hoping that
I'm hoping this will be a simple answer for one of you. We've got
I'm hoping this is quite a simple one, although after lots of Googling, I've
I'm hoping someone can help. I'm sure its just a simple one that I
I'm hoping this is a simple one. I run a Rails web app where
I am having this issue and I am hoping that it is so simple
I'm hoping this is something simple and small that I'm missing, but currently, This
I'm hoping to add a simple one-click solution to a webpage so that android
I'm hoping this question has a very simple answer. I can think of ways

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.