2015-10-17 40 views

回答

1

如果您想在CardWithList中爲每行使用不同的版式,則無法執行此操作。

如果你想使用自定義佈局爲

至於其他的卡,你可以使用自定義佈局內代替default layout。 您可以設置它在你的構造函數,例如:

public WeatherCard(Context context) { 
    super(context,R.layout.carddemo_extras_inner_base_main_cardwithlist); 
} 

您的佈局必須提供元素與`

<it.gmariotti.cardslib.library.prototypes.LinearListView 
     android:id="@+id/card_inner_base_main_cardwithlist" 
    /> 

也在裏面,你的佈局可以添加其他元素。
在這種情況下,您必須使用方法 setupInnerViewElements來設置它們。在這種情況下,調用超級方法非常重要。

@Override 
    public void setupInnerViewElements(ViewGroup parent, View view) { 
     //It is very important call the super method!! 
     super.setupInnerViewElements(parent, view); 

     //Your elements 
    } 

你可以找到更多info here:

+0

是啊,我已經充氣自定義佈局和正常工作:)。我不確定通過在佈局中添加其他元素能夠理解你的意思嗎?你能解釋更多嗎? – RedEagle

+0

如果你有一個按鈕,例如使用該方法來設置一個OnClickListener –