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

设置图片大小后报错 #2

Closed
Jelly0726 opened this issue Sep 13, 2017 · 1 comment
Closed

设置图片大小后报错 #2

Jelly0726 opened this issue Sep 13, 2017 · 1 comment

Comments

@Jelly0726
Copy link

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);
}

@chaychan
Copy link
Owner

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

@chaychan chaychan closed this as completed Sep 3, 2018
@chaychan chaychan reopened this Sep 3, 2018
@chaychan chaychan closed this as completed Sep 3, 2018
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