0

我正在为 android 使用 cardlib

主Activity布局,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);

我提到了cardlib项目和代码是一样的,但我不能显示标题和副标题

4

0 回答 0