chaychan / BottomBarLayout

(一个轻量级的底部导航控件)A simple and lightly widget to accomplish bottom Navigation,可设置未读数、提示点、提示消息

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

设置图片大小后报错

Jelly0726 opened this issue · comments

Caused by: java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.widget.LinearLayout$LayoutParams
at com.chaychan.library.BottomBarItem.init(BottomBarItem.java:128)
at com.chaychan.library.BottomBarItem.(BottomBarItem.java:88)
at com.chaychan.library.BottomBarItem.(BottomBarItem.java:54)


if (mIconWidth != 0 && mIconHeight != 0){
//如果有设置图标的宽度和高度,则设置ImageView的宽高
LayoutParams imageLayoutParams = (LayoutParams) mImageView.getLayoutParams();
imageLayoutParams.width = mIconWidth;
imageLayoutParams.height = mIconHeight;
mImageView.setLayoutParams(imageLayoutParams);
}
修改为可解决:
if (mIconWidth != 0 && mIconHeight != 0){
//如果有设置图标的宽度和高度,则设置ImageView的宽高
FrameLayout.LayoutParams imageLayoutParams = (FrameLayout.LayoutParams) mImageView.getLayoutParams();
imageLayoutParams.width = mIconWidth;
imageLayoutParams.height = mIconHeight;
mImageView.setLayoutParams(imageLayoutParams);
}

@Jelly0726 多谢你的反馈,现在已经修复。