我正在使用cardlib for android
主要活动布局,renew_Card是具有大图像的材料卡
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/scrollView"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<it.gmariotti.cardslib.library.view.CardView
android:id="@+id/statcard"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
/>
<it.gmariotti.cardslib.library.view.CardViewNative
android:id="@+id/renew_Card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card:card_layout_resourceID="@layout/native_material_largeimage_card"
style="@style/card_external"
/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
这是我的Java代码
ArrayList<BaseSupplementalAction> actions = new ArrayList<BaseSupplementalAction>();
IconSupplementalAction t1 = new IconSupplementalAction(this, R.id.renew_Licence);
t1.setOnActionClickListener(new BaseSupplementalAction.OnActionClickListener() {
@Override
public void onClick(Card card, View view) {
Toast.makeText(MainActivity.this, "Click to Renew Licence", Toast.LENGTH_SHORT).show();
}
});
actions.add(t1);
MaterialLargeImageCard mRenewcard =
MaterialLargeImageCard.with(this)
.setTextOverImage("Licence Details")
.setTitle("Domain: http://www.example.net")
.setSubTitle("Expires in 17 Days")
.useDrawableId(R.drawable.tintbg)
.setupSupplementalActions(R.layout.material_buttons, actions)
.build();
CardViewNative mcardView = (CardViewNative) findViewById(R.id.renew_Card);
mcardView.setCard(mRenewcard);
我提到了cardslib项目和代码相同,但我无法显示标题和副标题