Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一个小BUG #3

Closed
XYRZX opened this issue Jul 13, 2018 · 1 comment
Closed

一个小BUG #3

XYRZX opened this issue Jul 13, 2018 · 1 comment

Comments

@XYRZX
Copy link

XYRZX commented Jul 13, 2018

/**设置数据集合*/
public void setDatas(List<String> datas){
       this.mDatas = datas;
       this.mViewFlipper.removeAllViews();
       if (DisplayUtils.notEmpty(mDatas)){
           for (int i = 0; i < mDatas.size(); i++) {
               TextView textView = new TextView(getContext());
               textView.setText(mDatas.get(i));
               //任意设置你的文字样式,在这里
               textView.setSingleLine(isSingleLine);
               textView.setTextColor(mTextColor);
               textView.setTextSize(mTextSize);
               textView.setGravity(mGravity);
               mViewFlipper.addView(textView,i);//添加子view,并标识子view位置
           }
       }
   }

在setDatas方法上,加上 this.mViewFlipper.removeAllViews();
否者多次赋值后,再点击会出现闪退

@ChessLuo
Copy link
Owner

@XYRZX 刚查了调试了下代码,确实存在这个问题;谢谢大神指教,已修改代码。

@ChessLuo ChessLuo closed this as completed Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants