如何显示使用的CoverFlow如图所示附加图像链接四象?如图所示、图像、四象、链接

2023-09-03 22:31:09 作者:拭呿の涙氺

我是新来的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

和 $ 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>