Closed darkcgd closed 7 years ago
上拉加载自定义布局实现IFooterCallBack,有些方法不回调,例如callWhenNotAutoLoadMore().onStateReady(),onReleaseToLoadMore()
以下是我上拉加载自定义布局的代码 public class LoadDataFootView extends LinearLayout implements IFooterCallBack { private ImageView imgAnim; AnimationDrawable drawable; private TextView move; private View view;
private boolean showing = true; public LoadDataFootView(Context context) { super(context); setBackgroundColor(Color.parseColor("#f3f3f3")); initView(context); } /** * @param context * @param attrs */ public LoadDataFootView(Context context, AttributeSet attrs) { super(context, attrs); setBackgroundColor(Color.parseColor("#f3f3f3")); initView(context); } private void initView(Context context) { view = LayoutInflater.from(context).inflate(R.layout.load_foot_tip_view, this); imgAnim = (ImageView) findViewById(R.id.refresh); drawable = (AnimationDrawable) imgAnim.getDrawable(); move = (TextView) findViewById(R.id.handler_move); } @Override public void show(boolean show) { if (show == showing) { return; } showing = show; LayoutParams lp = (LayoutParams) view.getLayoutParams(); lp.height = show ? LayoutParams.WRAP_CONTENT : 0; view.setLayoutParams(lp); } @Override public void callWhenNotAutoLoadMore(final XRefreshView xRefreshView) { move.setText("点击加载更多"); move.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { xRefreshView.notifyLoadMore(); } }); } @Override public void onStateReady() { move.setText("松开加载更多"); drawable.start(); } @Override public void onStateRefreshing() { move.setText("正在加载..."); drawable.start(); show(true); } @Override public void onReleaseToLoadMore() { move.setText("松开加载更多"); drawable.start(); } @Override public void onStateFinish(boolean success) { drawable.stop(); } @Override public void onStateComplete() { //setVisibility(View.GONE); AbToastUtil.showToast("onStateComplete"); } @Override public boolean isShowing() { return showing; } @Override public int getFooterHeight() { return getMeasuredHeight(); }
}
我用的是 xRefreshview.setCustomFooterView(new LoadDataFootView(getActivity()));
求解
see #93
上拉加载自定义布局实现IFooterCallBack,有些方法不回调,例如callWhenNotAutoLoadMore().onStateReady(),onReleaseToLoadMore()
以下是我上拉加载自定义布局的代码 public class LoadDataFootView extends LinearLayout implements IFooterCallBack { private ImageView imgAnim; AnimationDrawable drawable; private TextView move; private View view;
}
我用的是 xRefreshview.setCustomFooterView(new LoadDataFootView(getActivity()));
求解