Hi i am developing application in android.In that i displayed some images in coverflow view that was working fine.Below that cover flow view i need to display some data in list view.I am new to android and i don't know how to display the listview below the coverflow view.please help me,here my code:

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

    <com.coverflow.Coverflow
        android:id="@+id/cover_flow"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />


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


</LinearLayout>

My Activity class:


public class NewspaperCoverFlowActivity extends Activity 
{
    /** Called when the activity is first created. */
    ListViewwithimageAdapter listadapter;
    ListView list;
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);  

        Coverflow coverFlow;
        coverFlow = new Coverflow(this);

        coverFlow.setAdapter(new ImageAdapter(this));
        ImageAdapter coverImageAdapter =  new ImageAdapter(this);

        coverFlow.setAdapter(coverImageAdapter);          

        coverFlow.setGravity(Gravity.TOP);

        coverFlow.setSpacing(2);
        coverFlow.setSelection(1, true);
        coverFlow.setAnimationDuration(1500);   
//        setContentView(coverFlow);
        ListView list = (ListView)findViewById(R.id.list);
        listadapter = new ListViewwithimageAdapter(this);
        list.setAdapter(listadapter);



    }



    }
有帮助吗?

解决方案

Create a LinearLayout with the orientation set to vertical and set that as your content view. Then add the Cover flow view and the list view to the layout.

If you do it in a layout xml it would be something like this (change the "com.example.package" to the pckage where your CoverFlow is located):

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <com.example.package.CoverFlow
        android:id="@+id/cover_flow"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />


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

</LinearLayout>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top