xRecyclerView
xRecyclerView = findViewById(R.id.xRecylerView);
//设置
xRecyclerView.setLayoutManager(new LinearLayoutManager(this));
xRecyclerView.addItemDecoration(new MyDecoration(this, MyDecoration.VERTICAL_LIST));
//设置
xRecyclerView.setPullRefreshEnabled(true);//下拉刷新
xRecyclerView.setLoadingMoreEnabled(true);//上拉加载
xRecyclerView.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader);//样式
xRecyclerView.setLoadingMoreProgressStyle(ProgressStyle.Pacman);
//监听
xRecyclerView.setLoadingListener(new XRecyclerView.LoadingListener() {
@Override
public void onRefresh() {
//调用presenter里面的刷新方法
presenter.showNewDataToView(new ModeImpl(), MainActivity.this);
}
@Override
public void onLoadMore() {
//调用presenter里面的加载更多方法
}
});
popupwindow
View view = LayoutInflater.from(MainActivity.this).inflate(R.layout.pop_item,null);
//设置view里面的数据
ListView listView = view.findViewById(R.id.listView);
listView.setAdapter(new BaseAdapter() {
@Override
public int getCount() {
return item.length;
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView textView = new TextView(MainActivity.this);
textView.setText(item[position]);
textView.setTextSize(20);
return textView;
}
});
PopupWindow popupWindow = new PopupWindow(view, 200, ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.setBackgroundDrawable(new ColorDrawable(getResources().getColor(android.R.color.transparent)));
popupWindow.setOutsideTouchable(true);
popupWindow.showAsDropDown(imageView,0,10);