我想在我的布局中实现Swipe Stack View我已经做了所有完美的事情但我不能在我的布局中看不到SwipeStackView ...... StackVIew应该在Activity中单身吗?
Stack view在布局中,我在父视图中设置了android:clipChildren="false"
。
<link.fls.swipestack.SwipeStack
android:layout_gravity="center"
android:id="@+id/swipe_deck"
app:disable_hw_acceleration="false"
android:layout_width="match_parent"
android:layout_height="150dp"
app:stack_rotation="10"
app:stack_size="3" />
这就是我在我的java文件中安装的方式
swipeDeck = findViewById(R.id.swipe_deck);
swipeDeck.setAdapter(new SwipeLayoutAdapter(todayMeetingModelList));
swipeDeck.setListener(new SwipeStack.SwipeStackListener() {
@Override
public void onViewSwipedToLeft(int position) {
}
@Override
public void onViewSwipedToRight(int position) {
}
@Override
public void onStackEmpty() {
swipeDeck.resetStack();
}
});
这就是我设置适配器的方式
public class SwipeLayoutAdapter extends BaseAdapter{
private List<TodayMeetingModel> todayMeetingModelList;
public SwipeLayoutAdapter(List<TodayMeetingModel> todayMeetingModelList) {
this.todayMeetingModelList = todayMeetingModelList;
}
@Override
public int getCount() {
return todayMeetingModelList.size();
}
@Override
public Object getItem(int position) {
return todayMeetingModelList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView==null) convertView = getLayoutInflater().inflate(R.layout.card_view_today_club_meeting,parent,false);
TodayMeetingModel todayMeetingModel = todayMeetingModelList.get(position);
TextView clubNameTV = convertView.findViewById(R.id.clubMeetingNameTV);
clubNameTV.setText(todayMeetingModel.getClub_name());
TextView timeTV = convertView.findViewById(R.id.timeTV);
timeTV.setText(todayMeetingModel.getClub_meeting_time());
TextView dateTV = convertView.findViewById(R.id.dateTV);
dateTV.setText(todayMeetingModel.getDay_name());
TextView addressTV = convertView.findViewById(R.id.clubAddressTV);
addressTV.setText(todayMeetingModel.getClub_address());
return convertView;
}
}
我的问题是SwipeStackView在屏幕上不可见......