由网友(拭呿の涙氺)分享简介:我是新来的Android和我想开发应显示设在绘制文件夹中的图像应用程序,如显示的图像:I am new to android and I am trying to develop the app that should display the images located in the drawable folde...
我是新来的Android和我想开发应显示设在绘制文件夹中的图像应用程序,如显示的图像:
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>
相关推荐
最新文章