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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:43:02+00:00 2026-05-23T14:43:02+00:00

I recently just overhauled my application to use ListView instead of using the classic

  • 0

I recently just overhauled my application to use ListView instead of using the classic TextView.setText and looping the inflation of a layout. I was able to acheive this very well but now I’m having a problem having it fill the screen. Heres the section of my code that does the work.

        //Place JSON data into array one item at a time
        JSONArray jArray = new JSONArray(result);
        //Loop through each record in the database
        //Get ListView
        ListView lv= (ListView)findViewById(R.id.listview);
        // create the grid item mapping
        String[] from = new String[] {"lblQuote", "lblBuzzed", "lblShared", "lblSaid", "lblLikes", "lblHates", "lblLocation", "lblDate"};
        int[] to = new int[] { R.id.lblQuote, R.id.lblBuzzed, R.id.lblShared, R.id.lblSaid, R.id.lblLikes, R.id.lblHates, R.id.lblLocation, R.id.lblDate };

        for(int i=0;i<jArray.length();i++){
            Log.i("uDrew Debug", "Made it into JSONArray Loop");

            //Get this record
            JSONObject json_data = jArray.getJSONObject(i);

            //Put each result into variables for later handling
            strFName = json_data.getString("FName");
            strLInitial = json_data.getString("LInitial");
            strCity = json_data.getString("City");
            strState = json_data.getString("State");
            strDate = json_data.getString("Date");
            strQuote = json_data.getString("Quote");
            intLikes = Integer.parseInt(json_data.getString("Likes"));
            intHates = Integer.parseInt(json_data.getString("Hates"));
            strFNameSaid = json_data.getString("FNameSaid");
            strLInitialSaid = json_data.getString("LInitialSaid");
            intBuzz = Integer.parseInt(json_data.getString("Buzz"));


            Log.i("uDrew Debug", "Made it past JSON Parsing");


            switch(intBuzz){
                case 1: 
                    strBuzzed = ("One Beer\nSyndrome");
                    break;
                case 2: 
                    strBuzzed = ("Buzzed");
                    break;
                 case 3: 
                     strBuzzed = ("Drunk");
                    break;
                 case 4: 
                     strBuzzed = ("Trashed");
                    break;
                 case 5: 
                    strBuzzed = "Retarded";
                    break;
            }                       
            HashMap<String, String> map = new HashMap<String, String>();
            map.put("lblQuote", strQuote);
            map.put("lblBuzzed", strBuzzed);
            map.put("lblShared", strFName + " " + strLInitial);
            map.put("lblSaid",strFNameSaid + " " + strLInitialSaid);
            map.put("lblDate", strDate);
            map.put("lblLocation", strCity + ", " + strState);
            map.put("lblLikes", intLikes.toString());
            map.put("lblHates", intHates.toString());
            fillMaps.add(map);



        }//End For loop
     // fill in the grid_item layout
     SimpleAdapter adapter = new SimpleAdapter(this, fillMaps, R.layout.myviews, from, to);
     lv.setAdapter(adapter);

main.xml:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:fillViewport="true"
    android:scrollbars="vertical">

        <LinearLayout 
            android:orientation="vertical" 
            android:id="@+id/myMainLayout" 
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content">   
              <com.google.ads.AdView android:id="@+id/adViewer"
                         android:layout_width="fill_parent"
                         android:layout_height="wrap_content"
                         ads:adUnitId="a14de539f600385"
                         ads:adSize="BANNER"
                         ads:loadAdOnCreate="true"/>
        <TextView 
            android:layout_height="wrap_content" 
            android:layout_width="fill_parent" 
            android:text="RandomDrunkQuotes.com" 
            android:id="@+id/lblTitle" 
            android:textSize="16px" 
            android:padding="5px" 
            android:textStyle="bold" 
            android:gravity="center_horizontal"/>

    <!-- List Divider -->
    <View android:layout_width="fill_parent"
        android:layout_height="1dip"
        android:background="?android:attr/listDivider" />

    <!-- ListView (grid_items) -->
    <LinearLayout android:id="@+id/layout"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent">
        <ListView android:id="@+id/listview"
            android:layout_height="fill_parent"
            android:layout_width="fill_parent">
        </ListView>
    </LinearLayout>


</LinearLayout>
</ScrollView>

myviews.xml:

<?xml version="1.0" encoding="utf-8"?>  
<LinearLayout android:id="@+id/LinearLayout01"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
            <TextView 
                android:id="@+id/lblQuote" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="Filler Text"/>
        </LinearLayout>
        <LinearLayout 
            android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="left">
           <ImageView
                android:id="@+id/imgUp"
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_weight="0"
                android:paddingLeft="5px"
                android:paddingRight="5px"
                android:src="@drawable/thumbsup"
                android:layout_gravity="left"/>
           <TextView 
                android:id="@+id/lblLikes" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_weight="0"
                android:paddingLeft="5px"
                android:paddingRight="5px"
                android:textSize="4pt"
                android:text="10"
                android:layout_gravity="left"/>

           <TextView 
                android:id="@+id/lblBuzzedTitle" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:textSize="4pt"
                android:text="Buzz Level:"/>
            <TextView 
                android:id="@+id/lblShared" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:text="Shared By: Filler Name"
                android:textSize="4pt"/>
            <TextView 
                android:id="@+id/lblSaid" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:text="Said By: Filler Name"
                android:textSize="4pt"/> 
        </LinearLayout>
        <LinearLayout 
            android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="left">
            <ImageView
                android:id="@+id/imgDown"
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_weight="0"
                android:paddingLeft="5px"
                android:paddingRight="5px"
                android:src="@drawable/thumbsdn"
                android:layout_gravity="center_vertical"/>
          <TextView 
                android:id="@+id/lblHates" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_weight="0"
                android:paddingLeft="5px"
                android:paddingRight="5px"
                android:textSize="4pt"
                android:text="2"
                android:layout_gravity="center_vertical"/>

           <TextView 
                android:id="@+id/lblBuzzed" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:text="High"
                android:textSize="4pt"
                android:layout_gravity="center_vertical"/>
            <TextView 
                android:id="@+id/lblDate" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:textSize="4pt"
                android:text="04/04/1987 4:32 PM"
                android:layout_gravity="center_vertical"/>
            <TextView 
                android:id="@+id/lblLocation" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:textSize="4pt"
                android:text="Broomfield, CO"
                android:layout_gravity="center_vertical"/> 
        </LinearLayout>
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:weightSum="1">
          <TextView
            android:text=" "
            android:textSize="1pt"
            android:background="#6F7285"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"/>  

        </LinearLayout>
</LinearLayout>

Heres what the App looks like:
enter image description here

There are also no scrollbars and if I change the main.xml ScrolView layout_height=”fill_parent” it extends to the end of the screen but the scrollable option isn’t there.

  • 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-05-23T14:43:03+00:00Added an answer on May 23, 2026 at 2:43 pm

    The following code fixed my problem:

     <?xml version="1.0" encoding="utf-8"?>
     <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:orientation="vertical" 
    android:id="@+id/BigLayout" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:fillViewport="true"
    android:scrollbars="vertical">
    
        <LinearLayout 
            android:orientation="vertical" 
            android:id="@+id/myMainLayout" 
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content">   
    
            <com.google.ads.AdView android:id="@+id/adViewer"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                ads:adUnitId="a14de539f600385"
                ads:adSize="BANNER"
                ads:loadAdOnCreate="true"/>
            <TextView 
                android:layout_height="wrap_content" 
                android:layout_width="fill_parent" 
                android:text="RandomDrunkQuotes.com" 
                android:id="@+id/lblTitle" 
                android:textSize="16px" 
                android:padding="5px" 
                android:textStyle="bold" 
                android:gravity="center_horizontal"/>
    
            <!-- List Divider -->
            <View 
                android:layout_width="fill_parent"
                android:layout_height="1dip"
                android:background="?android:attr/listDivider" />       
    
        </LinearLayout>
    
            <!-- ListView (grid_items) -->
            <ListView 
                android:id="@+id/listview"
                android:layout_height="fill_parent"
                android:layout_width="fill_parent">
            </ListView>     
    
     </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just recently switched to using the NullSoft Installer for my .NET application. By
I just recently update my Rails application to use Authlogic. The authentication works fine
I have recently just created Java project using Eclipse that requires 2 JAR files
Recently I just got assigned a project to develop a web application/site that uses
I just recently started using this library (the one from CodePlex), but I ran
Just recently I came over an idea called the Application Strangler Pattern . As
I just recently started with object oriented programming, using java. Before I was programming
I just recently started using Hudson as a CI server for a project of
I just recently inherited a Rails application and am debating an architectural decision moving
I just recently started looking into exceptions and best practices for their use and

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.