简体   繁体   English

Android Coverflow视图

[英]android coverflow view

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: 嗨,我正在用android开发应用程序,因为我在Coverflow视图中显示了一些图像,效果很好。在Coverflow视图下面,我需要在列表视图中显示一些数据。我是android的新手,我不知道该怎么做在Coverflow视图下方显示listview。请帮我,这里是我的代码:

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. 创建方向设置为垂直的LinearLayout并将其设置为内容视图。 Then add the Cover flow view and the list view to the layout. 然后将Cover flow视图和list视图添加到布局中。

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): 如果您在布局xml中执行此操作,则将类似于以下内容(将“ com.example.package”更改为CoverFlow所在的pckage):

<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 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM