Closed hruship0099 closed 1 year ago
Hello, if you could make a reproduction sample, I can take a look at it, but without the code it is hard for me to find the specific cause.
@dzolnai sorry for the late reply. Pl. find the below video ref. https://drive.google.com/file/d/1RuQLpnbRq-zYlmly97f59E-FS7na8Syk/view?usp=drivesdk
Here, when program is scrolling to the right some programs title is getting chopped off. Can we apply padding only to the current focused program?
@dzolnai We have a requirement of having multiple views inside a program card, like an image at the start & end of the program title. So whenever a user navigates to past or future program cards, all the above mentioned views for a program should stay aligned to left & only cards should move back or forth. As per library as there is only a textview(program title), this behavior is possible, but in our case as mentioned above we are facing some alignment issues as attached in previous video.
Could you please help us on a possibility to achieve our use case
@dzolnai can you please help on this as I am blocked.
Hello @hruship0099 , I was on my vacation last week, I'll try to arrange some time for this in the coming days. I'll get back to you with a more detailed reply then.
hello @dzolnai did you get a chance to look into this?
@hruship0099 I got some time now. Can you share your code which is not working as expected?
@dzolnai I need to move the entire layout elements instead of only text. How can I modify this method to support entire layout scroll
private fun layoutVisibleArea(leftOffset: Int, rightOffset: Int) { val width = schedule?.width ?: 0 var leftPadding = max(0, leftOffset) var rightPadding = max(0, rightOffset) val minWidth = min(width, itemTextWidth + 2 * staticItemPadding) Log.e(TAG, "Padding 1 are $width, $leftOffset, $rightOffset, $leftPadding, $rightPadding, $minWidth") if (leftPadding > 0 && width - leftPadding < minWidth) { leftPadding = max(0, width - minWidth) } if (rightPadding > 0 && width - rightPadding < minWidth) { rightPadding = max(0, width - minWidth) } Log.e(TAG, "Padding 2 are $leftPadding, $rightPadding") if (parent.layoutDirection == LAYOUT_DIRECTION_LTR) { Log.e(TAG, "Padding 3 are $leftPadding, $rightPadding, $staticItemPadding, $paddingStart, $paddingEnd") if (leftPadding + staticItemPadding != paddingStart || rightPadding + staticItemPadding != paddingEnd) { // The size of this view is kept, no need to tell parent. preventParentRelayout = true
titleView.setPaddingRelative(
leftPadding + staticItemPadding,
0,
rightPadding + staticItemPadding,
0
)
time.setPaddingRelative(
leftPadding + staticItemPadding,
0,
rightPadding + staticItemPadding,
0
)
preventParentRelayout = false
}
} else {
if (leftPadding + staticItemPadding != paddingEnd || rightPadding + staticItemPadding != paddingStart) {
// In this case, we need to tell the parent to do a relayout, RTL is a bit more complicated, it seems.
titleView.setPaddingRelative(
rightPadding + staticItemPadding,
0,
leftPadding + staticItemPadding,
0
)
time.setPaddingRelative(
rightPadding + staticItemPadding,
0,
leftPadding + staticItemPadding,
0
)
}
}
}
You could replace titleView
with a ViewGroup (such as FrameLayout, or ConstraintLayout). And then put the items in there.
@dzolnai after moving elements inside Relative layout, program container is not aligned properly. Also, its not scrolling. Pl. find the below video ref and code which I have tried https://user-images.githubusercontent.com/8926002/194844626-94a9852d-e58b-4ca1-888e-97009e4ce62a.mp4
@dzolnai pl. help me with the changes need to be done in the above code files.
@dzolnai @johankool @petercv @sndpl can you please suggest me the changes required in achieving scrolling for my layout.
I too face the same issue, can someone help to fix this
@dzolnai pl. update on the above.
@hruship0099 @MujammilAhamed first of all, sorry for the late reply. I tried to apply the changes you have sent to me to the project, but scrolling still works as expected. I can only look into this, when you send me a diff or compressed project, where the issue can be reproduced.
@dzolnai This issue has been resolved now with different approach. Thank you for your support.
@dzolnai How can we achieve in scrolling the program info like in the below screenshot when duration is long. With just program title and time, its working fine. With images, content is not scrolling as expected. can you pl. help in achieving this
Thanks