-2
我创建了CustomListView。现在我想显示'ShowCaseView',当我得到我的列表视图是空的。它可能与否。当我的列表视图为空时,如何显示ShowCaseView
我创建了CustomListView。现在我想显示'ShowCaseView',当我得到我的列表视图是空的。它可能与否。当我的列表视图为空时,如何显示ShowCaseView
也许之前运行初始化或检查的大小= 0
如果你的目标是创建一个ShowCaseView没有目标,因为你的列表视图是空的,你可以使用!;
ShowcaseView.Builder showCaseViewBuild = new ShowcaseView.Builder(mActivity)
.setTarget(Target.NONE)
.[your_other_configuration_stuff_here];
,然后如果你试图触发此当列表视图是空的,你可以设置更改到ListView层次的监听器等;
ListView lv = new ListView(mActivity);
//[your ListView setup code here... then the listener below]
lv.setOnHierarchyChangeListener(new ViewGroup.OnHierarchyChangeListener() {
@Override
public void onChildViewAdded(View parent, View child) {
}
@Override
public void onChildViewRemoved(View parent, View child) {
// trigger your ShowCaseView here when no children are left
// TODO
}
});
这是可能的,检查是否列表尺寸是0,并且进行到显示showcaseview –
检查是否'阵列== NULL || array.isEmpty()'然后显示ShowCaseView否则显示列表视图。 – user392117
我该如何处理notifyDataSetChanged()方法。因为在我的情况下,它会自动刷新列表视图? – Nik