0

Below is my layout in xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

        <it.gmariotti.cardslib.library.view.CardViewNative
            android:id="@+id/my_nice_card_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            card:card_layout_resourceID="@layout/native_cardwithlist_layout"
            style="@style/card_external"/>

</LinearLayout>

I want to programmatically create this view CardViewNative, which is from the cardslib library. But I am troubled by the card:card_layout_resourceID and the style attributes. How to create this CardViewNative in code?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Jonas
  • 534
  • 8
  • 16
  • Analize CardViewNative source and check what is done with card_layout_resourceID, does it call any method? If yes - use the same method to supply your card_layout_resourceID. If the method is private you're out of luck (or - use reflection)... – ssuukk Sep 25 '15 at 12:46
  • The best way is to define with a xml and then inflate programmatically. – Gabriele Mariotti Sep 26 '15 at 10:42
  • @Gabriele Mariotti I enjoy using your library. Thanks for your effort. The cards are nice and very customizable. I have another question: what is the right place to set onTouchListener for a card in a CardListView? – Jonas Sep 30 '15 at 09:06
  • If you want a ClickListener the best place is in the card. If you need a touchListener, it depends by what you want to achieve. – Gabriele Mariotti Sep 30 '15 at 10:57
  • Thanks for your comment. I just want to make the card "pump"/"throb" as in lines 133-155 of your [NativeShadowFragment](https://github.com/gabrielemariotti/cardslib/blob/e15f188671b36a6747dd003bec9ebf4097fd9d8b/demo/stock/src/main/java/it/gmariotti/cardslib/demo/fragment/nativeview/NativeShadowFragment.java). – Jonas Sep 30 '15 at 11:01

0 Answers0