?????
??????????????
????????ui????????????project?????????github??????????????????project?????????????
????????????????????????????????????????????studio?apk??????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????
????
???????????????????????
- ??????????????????????view?????
- ?????????view???????????
- ??????ViewGroup???view??????????
- ???????????????????????
????????look look?
????
1. ?xml?????CardSlidePanel
<com.stone.card.library.CardSlidePanel
android:id="@+id/image_slide_panel"
android:layout_width="match_parent"
android:layout_height="match_parent"
card:bottomMarginTop="38dp"
card:itemMarginTop="10dp"
card:yOffsetStep="13dp" />
2. ??????
cardSwitchListener = new CardSlidePanel.CardSwitchListener() {
@Override
public void onShow(int index) {
Log.d("Card", "????-" + dataList.get(index).userName);
}
@Override
public void onCardVanish(int index, int type) {
Log.d("Card", "????-" + dataList.get(index).userName + " ??type=" + type);
}
}
; slidePanel.setCardSwitchListener(cardSwitchListener);
3. ??Adapter
slidePanel.setAdapter(new CardAdapter() {
@Override
public int getLayoutId() {
// layout?? return R.layout.card_item;
}
@Override
public int getCount() {
// ???? return dataList.size();
}
@Override
public Rect obtainDraggableArea(View view) {
// ????????????? return new Rect(....)
}
@Override
public void bindView(View view, int index) {
// ???????demo viewHolder.bindData(dataList.get(index));
}
}
);
4. ????
// appendDataList adapter.notifyDataSetChanged();
Demo???
apk download (??thisProj????)
License
Copyright 2016, xmuSistone Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.