2011-11-17 62 views
1

我試過下面的代碼,它對Activity類的工作很好,但我需要擴展ListActivity類,但是這段代碼給出了異常。 此類擴展ListActivity如何在ListActivity上添加coverflowView?

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". 
+0

把你的異常日誌貓還 –

回答

0

下面是答案:

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); 
相關問題