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 7794961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:55:46+00:00 2026-06-01T22:55:46+00:00

I am using following layout for my list view items. <?xml version=1.0 encoding=utf-8?> <TextView

  • 0

I am using following layout for my list view items.

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://scheme.android.com/apk/res/android"
    android:id="@+id/text1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:paddingLeft="10dip"
    android:textSize="18sp"
    android:minHeight="40sp"
    />

But I am getting an error in the logcat java.lang.RuntimeException … that you must supply a layout_width argument.

My main.xml is

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/widget28"
    android:background="#ff000033"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <ImageView
        android:layout_width="70px"
        android:layout_height="30px"
        android:paddingLeft="2px"
        android:paddingTop="2px"
        android:background="@drawable/ic_launcher"
     ></ImageView>

    <ListView
        android:id="@+id/myListView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        />
</LinearLayout>

and this is my activity’s onCreate code

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    context=this.getApplicationContext();
    this.setTitle("NP Headline News");

    myListView=(ListView)findViewById(R.id.myListView);
    myListView.setOnItemClickListener(new OnItemClickListener(){

            @Override
        public void onItemClick(AdapterView<?> arg0, View v, int index,long id) {
                // TODO Auto-generated method stub
                String urlAddress=urlAddresses[index];
                String urlCaption = urlsCaptions[index];
            }

    });

  int layoutId=R.layout.simple_list_item_1;
   // int layoutId=android.R.layout.simple_list_item_1;
    aa = new ArrayAdapter<String>(this,layoutId,this.urlsCaptions);

    myListView.setAdapter(aa);
}

I think that it is something related to my simple_list_item_1 because if I use android.R.layout.simple_list_item_1 then every thing works ok

  • 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-01T22:55:47+00:00Added an answer on June 1, 2026 at 10:55 pm

    Here is your error cleared layout:

    <?xml version="1.0" encoding="utf-8"?>
    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/text1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:paddingLeft="10dip"
        android:textSize="18sp"
        android:minHeight="40sp"
    
        />
    

    Can you able to differentiate your error contained code and this above one.

    I wish you guys to don’t tense and urge while code something, that must be lead you to blocked and confused minded.

    For these type of errors, you could use to debug yourself with the help of DDMS.
    Because the code is very very simple to view right.

    And some words about the previous answers:

    Guys that is not necessary to declare a TextView or any View only inside of the Layout file.

    It is also a View, So it can capable to sit alone in a Canvas.

    And also the problem is not by the "fill_parent", and "match_parent" Something.

    I think you might be tensed now also, because i am taking this much time to give you the reason of your error.

    Here we go,

    the error is because simply in the following line,

    xmlns:android="http://schemas.android.com/apk/res/android"
    

    In the above line you mistakenly typed scheme instead of schemas.

    That is the error.

    So only i mentioned if you had look at the code with out tense you can get it easily.

    xmlns denotes the namespace , that should be proper in order make the android: prefixed attributes as valuable.

    Hope you understand and the answer helpful to you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the following to populate my ListView with checkbox-supported list: setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_checked, new
I have the following LinearLayout with a GridView in it: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=match_parent
in my android app i am using expandable list view to display some text.These
friends, i am using following tutorial to lazy load list view now problem is
I'm using the following code to use a ListView in CustomAlertDialog Layout . public
i am using following code. <RelativeLayout android:layout_width=310dp android:layout_height=70dp android:layout_below=@+id/UIReportView android:layout_marginLeft=4dp android:layout_marginTop=2dp android:background=@drawable/small_corners > small_corners
I have the following graph using dot layout: digraph G { graph [rankdir=LR]; subgraph
Using following code I try to get updated list of checkbuttons' corresponding text values,
I have learned that when using android:entries with a ListView , it uses android.R.layout.simple_list_item_1
I am trying to create a ListView using the following code: setListAdapter(new ArrayAdapter<String>(this, R.layout.settings_items,

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.