如何显示使用的CoverFlow如图所示附加图像链接四象? [英] How to display four images using coverflow as shown in the attach image link?

查看:137
本文介绍了如何显示使用的CoverFlow如图所示附加图像链接四象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的Andr​​oid和我想开发应显示设在绘制文件夹中的图像应用程序,如显示的图像:

I am new to android and I am trying to develop the app that should display the images located in the drawable folder, as shown in the image:

请提供建议,就如何实现这种效果。还提供了一些相应的链接,并解释code就会有强烈的AP preciated ...

Please provide suggestion on how to achieve this effect. Also providing some of the appropriate link and explaining the code will be highly appreciated...

推荐答案

下面是的CoverFlow库为Android

<一个href="https://github.com/Polidea/android-coverflow/blob/master/src/pl/polidea/coverflow/testingactivity/CoverFlowTestingActivity.java"相对=nofollow> $ C C例子$

And Code Example:

JAVA code

/****
 * The Class CoverFlowTestingActivity.
 */
public class CoverFlowTestingActivity extends Activity {

private TextView textView;

/*
 * (non-Javadoc)
 * 
 * @see android.app.Activity#onCreate(android.os.Bundle)
 */
    @Override
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);
        textView = (TextView) findViewById(this.getResources()
                .getIdentifier("statusText", "id", "pl.polidea.coverflow"));
        // note resources below are taken using getIdentifier to allow importing
        // this library as library.
        final CoverFlow coverFlow1 = (CoverFlow)     findViewById(this.getResources().getIdentifier("coverflow", "id",
                "pl.polidea.coverflow"));
        setupCoverFlow(coverFlow1, false);
        final CoverFlow reflectingCoverFlow = (CoverFlow)         findViewById(this.getResources().getIdentifier(
                "coverflowReflect", "id", "pl.polidea.coverflow"));
        setupCoverFlow(reflectingCoverFlow, true);
    }

    /**
     * Setup cover flow.
     * 
     * @param mCoverFlow
     *            the m cover flow
     * @param reflect
     *            the reflect
     */
    private void setupCoverFlow(final CoverFlow mCoverFlow, final boolean reflect) {
        BaseAdapter coverImageAdapter;
        if (reflect) {
        coverImageAdapter = new ReflectingImageAdapter(new ResourceImageAdapter(this));
        } else {
            coverImageAdapter = new ResourceImageAdapter(this);
        }
        mCoverFlow.setAdapter(coverImageAdapter);
        mCoverFlow.setSelection(2, true);
        setupListeners(mCoverFlow);
    }

/**
 * Sets the up listeners.
 * 
 * @param mCoverFlow
 *            the new up listeners
 */
    private void setupListeners(final CoverFlow mCoverFlow) {
        mCoverFlow.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(final AdapterView< ? > parent, final View view, final int position, final long id) {
                textView.setText("Item clicked! : " + id);
            }

        });
        mCoverFlow.setOnItemSelectedListener(new OnItemSelectedListener() {
            @Override
            public void onItemSelected(final AdapterView< ? > parent, final View view, final int position, final long id) {
                textView.setText("Item selected! : " + id);
            }

            @Override
            public void onNothingSelected(final AdapterView< ? > parent) {
                textView.setText("Nothing clicked!");
            }
        });
    }

}

XML

<?xml version="1.0" encoding="utf-8"?>

         

<pl.polidea.coverflow.CoverFlow
    xmlns:coverflow="http://schemas.android.com/apk/res/pl.polidea.coverflow"
    coverflow:imageWidth="100dip" coverflow:imageHeight="150dip" coverflow:withReflection="true"
    coverflow:imageReflectionRatio="0.2" coverflow:reflectionGap="2dip"
    android:id="@+id/coverflowReflect"
    android:layout_width="fill_parent" android:layout_height="wrap_content"
    android:layout_marginTop="5dip" />

<TextView android:text="STATUS" android:layout_width="fill_parent" android:layout_height="wrap_content"
    android:padding="5dip" android:id="@+id/statusText"></TextView>

这篇关于如何显示使用的CoverFlow如图所示附加图像链接四象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆