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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:55:11+00:00 2026-06-15T01:55:11+00:00

I have a ListView inside a Linearlayout. The listview has a custom cursoradapter. Everything

  • 0

I have a ListView inside a Linearlayout.
The listview has a custom cursoradapter.
Everything works fine, except the ListView does not scroll.

Any suggestion more than welcome!! Thanks. maurizio

Here is the XML of the MainActivity

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

    <Button
        android:id="@+id/buttonAdd"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:text="Aggiungi" />

    <ListView
        android:id="@+id/list"  
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</LinearLayout>

Here is the relevant piece of java code.

public class MainActivity extends Activity  {
    private DatabaseHelper db=null;
    private Cursor tabellaCursor=null;
    private ListAdapter adapter; 

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        int[] to = new int[] {R.id.name_entry};
        db = new DatabaseHelper(this);
        tabellaCursor=db.getWritableDatabase().rawQuery("SELECT _id, colonna1, colo      nna2, colonna3 FROM tabella ORDER BY _id", null);
        ListAdapter adapter=new MyAdapter(this, R.layout.list_example_entry, tabe     llaCursor, new String[]{"colonna1"},to);
        ListView lt = (ListView)findViewById(R.id.list); 
        lt.setAdapter(adapter); 
        Button addbtn=(Button)findViewById(R.id.buttonAdd);
        addbtn.setOnClickListener(new OnClickListener()
        {public void onClick(View v){add(); }
        });
}
  • 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-15T01:55:12+00:00Added an answer on June 15, 2026 at 1:55 am

    Your ListViews Layout param is “wrap_content”. it will expand as you add new items to litview. therefore it won’t scroll. If you set it to “match_parent” it will sure start scrolling.And dont forget that a view does scroll only if its contents(childs view what ever)
    size is bigger than it.

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

Sidebar

Related Questions

I have an ListView inside a HorizontalScrollView and it works perfectly fine, except for
i have an android application which has a listview for listing 14 items inside
I have a custom listview row whose XML has one ImageView and three TextViews
I have row for ListView(listview is inside LinearLayout) like <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android
I have a simple LinearLayout with ListView inside it ( match_parent both for width
I have a ListView composed of LinearLayouts. Inside each is an ImageView, TextView and
I have Activity with ListView inside it and in the onCreate method of the
I have a ListView with EditText inside. Actually, when i touch an element of
What I have going on is a listview inside of my windows form. How
I have a DropDownList inside in ListView.. I wanted to get a data when

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.