SwipeRevealLayout
SwipeRevealLayout copied to clipboard
Improper ListView row while changing orientation from Landscape to Portrait & vice-versa
Hi,
I observed that when you change orientation from Portrait to Landscape the ListView row sticks to the same width giving improper size of ListView row. Also, same is the case with changing orientation from Landscape to Portrait.
I am using
android:configChanges="orientation|keyboardHidden|screenSize"
in AndroidManifest.xml
Please provide the fix!
Thanks!
I found the issue to be caused by PR https://github.com/chthai64/SwipeRevealLayout/pull/33. If i skip the "width" calculation from this PR it works ok.
I tried to comment out
widthMeasureSpec = MeasureSpec.makeMeasureSpec(desiredWidth, widthMode);
But, it didn't work for me, it just centers the row, but doesn't full-screen its width
I commented desiredWidth = Math.max(child.getMeasuredWidth(), desiredWidth);
as well.
Also, I don't have android:configChanges="orientation|keyboardHidden|screenSize"
so my Activity is destroyed and re-created. There was an older issue about this and it is not implemented out of the box to handle configurationChange
so you would probably need to do it yourself.
If I don't comment anything & re-create the Activity again its already working fine, then why would I post the issue? Feels sick that you didn't look at my question properly!
Leaving asside your rude language, you would post this issue if you had the problem from this issue, even when re-creating the activity...
If this doesn't help you, maybe it will help someome else.
Ok, great! keep writing useless libraries & also don't dare to solve the bugs! Best of Luck & Get Well Soon!
Erm...I hope you know I am not the one that wrote this library or even contributed to it. I am just someone who uses it for a project. If you look at the activity on this library, you are better off debugging the issue yourself, like I did for my issue.
I have save issue with recyclerview. android:configChanges not work. Anyone have solution to resolve this issue.
Any help with the issue. It exists still
If this problem is actual in 2018, here's the solution
private void changeLayout() { int pageWidth = ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth(); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); params.width = pageWidth; mBinding.swipeLayout.setLayoutParams(params); }
where should i put that
The problem is that the children loose there layoutparams when created. So just make sure to reset your child layoutparams.
// first find the largest child
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
if(i == 1){
child.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
}
child.invalidate();
measureChild(child, widthMeasureSpec, heightMeasureSpec);
desiredWidth = Math.max(child.getMeasuredWidth(), desiredWidth);
desiredHeight = Math.max(child.getMeasuredHeight(), desiredHeight);
}