1. Check out our companion app, Forums for Android! Download from Google Play

Displaying the List view

Discussion in 'Application Development' started by SaumyaSam, Sep 24, 2012.

  1. SaumyaSam

    SaumyaSam New Member
    Thread Starter
    5

    Sep 24, 2012
    2
    0
    5
    Hi,
    I have two list view which is display data from the web service.

    List 1 -- with different background
    List 2 -- with different background

    I have two ArrayAdapter<String> to handle the values. I have issue in the display. my xml file is structured as

    <Linear Layout>
    <ListView> </ListView>
    <ListView> </ListView>
    <Linear Layout>

    its displays the two list items by dividing the screen into two equal parts and scrolls within the list individually.
    I wanted the List 1 to be displayed fully and then followed by List 2 and also it should screen should be scroll not with in the list but full screen so that List 2 could be seen below.
    Do help.. i tired many ways but still the results are not fine.

    Thanking in advance..
     

    Advertisement

  2. Unforgiven

    Unforgiven -.. --- - / -.. .- ... ....
    Moderator
    4,238

    Jun 23, 2010
    33,219
    32,562
    4,238
    Male
    Douglas, MA
    Welcome to Android Forums SaumyaSam. I moved your thread to the Application Development forum to get some better eyes on it.:)
     
  3. jonbonazza

    jonbonazza Well-Known Member
    163

    Jul 13, 2010
    1,934
    458
    163
    Male
    You will need to wrap your LinearLayout in a ScrollView, and then wrap that ScrollView in a LinearLayout.

    Also, you will need to make sure your attrributes are corrrect.
     
  4. SaumyaSam

    SaumyaSam New Member
    Thread Starter
    5

    Sep 24, 2012
    2
    0
    5
    Since am new to the android development please help me.

    the xml file


    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/dha_list_layout"
    android:eek:rientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <ScrollView
    android:id="@+id/dha_list_scroll"
    android:eek:rientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    >

    <LinearLayout
    android:id="@+id/dha_listlayout"
    android:eek:rientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    >

    <ListView
    android:id="@+id/FListView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fadeScrollbars="false"
    >

    </ListView>

    <ListView
    android:id="@+id/NListView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fadeScrollbars="false"
    >

    </ListView>
    </LinearLayout>
    </ScrollView>
    </LinearLayout>

    Am getting proper values from the webservice. I print those values in logcat.

    private ArrayAdapter<String> flistAdapter ;
    private ArrayAdapter<String> nlistAdapter ;

    ArrayList<String> flist_name = new ArrayList<String>();
    ArrayList<String> nlist_name = new ArrayList<String>();

    ListView flistview,nlistview;

    flistAdapter = new ArrayAdapter<String>(this, R.layout.featuredrow,flist_name);
    flistview.setAdapter(flistAdapter);

    nlistAdapter = new ArrayAdapter<String>(this, R.layout.normalrow,nlist_name);
    nlistview.setAdapter(nlistAdapter);

    I hope the code is fine. Please help me to display the items in listview.
     

Share This Page

Loading...