Android 如何在ListActivity上添加coverflowView?
我已经尝试编写了以下代码,这些代码对Activity类运行良好,但我需要扩展ListActivity类,但这段代码给出了一个异常。 此类扩展了ListActivityAndroid 如何在ListActivity上添加coverflowView?,android,Android,我已经尝试编写了以下代码,这些代码对Activity类运行良好,但我需要扩展ListActivity类,但这段代码给出了一个异常。 此类扩展了ListActivity setContentView(R.layout.main); textView = (TextView) findViewById(this .getResources() .getIdentifier("statusText", "id", "com.custo
setContentView(R.layout.main);
textView = (TextView) findViewById(this .getResources()
.getIdentifier("statusText", "id",
"com.customcoverflowproject.customcoverflowapplication"));
// note resources below are taken using getIdentifier to allow importing
// this library as library.
final CoverFlow coverFlow1 = (CoverFlow) findViewById(this
.getResources().getIdentifier("coverflow", "id",
"com.customcoverflowproject.customcoverflowapplication"));
setupCoverFlow(coverFlow1, false);
"CoverFlow is another class which inherit to Gallery".
答案如下:
final CoverFlow coverFlow1 = new CoverFlow(this);
relativeWWParam=new RelativeLayout.LayoutParams(new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT));
relativeFWParam=new RelativeLayout.LayoutParams(new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT));
relativeFFParam=new RelativeLayout.LayoutParams(new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT));
relativeWWParam.setMargins(-((width/2)+(width/10)), 0, 0, 0);
getListView().setLayoutParams(relativeWWParam);
把你的异常日志也放进去