mercredi 13 mai 2015

Cardslib round corners

I have two projects where I create a set of custom cards extending the card class, and then I insert them into a StaggeredView.

My problem is that in one of these projects the cards corners are automatically rounded, while on the other one not!

Here's my code:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.staggered_grid);

    List<Tour> data = createList(10);

    ArrayList<Card> cardes = initCards(data);

    mCardArrayAdapter = new CardGridStaggeredArrayAdapter(ListViewPrenota.this, cardes);

    CardGridStaggeredView mGridView = (CardGridStaggeredView)
            ListViewPrenota.this.findViewById(R.id.carddemo_extras_grid_stag);

    if (mGridView != null) {
        mGridView.setAdapter(mCardArrayAdapter);
    }
}


private ArrayList<Card> initCards(List<Tour> data){

    ArrayList<Card> cards = new ArrayList<>();
    for(int i = 0; i <= data.size()-1; i++ ){
        DeviceCardList card = new DeviceCardList(this, R.layout.cardslib_inner_layout, data.get(i));

        cards.add(card);
    }
    return cards;
}

DeviceCardList: class

cardslib_inner_layout: xml file

staggered_view.xml: xml file

Aucun commentaire:

Enregistrer un commentaire