Android, make scrollable view overflow to the left instead of right?

前端 未结 7 2021
孤独总比滥情好
孤独总比滥情好 2021-02-20 00:02

I was recommended using a parent view to get horizontal scrolling right in my TextView:



        
7条回答
  •  一整个雨季
    2021-02-20 00:11

    I'm quite late at this, but here's a simple and easy approach by using rotation of the views.

    horizontal_layout_id.setRotationY(180f)
    

    The above code inverts the whole horizontal layout horizontally, this make the text start on the right instead of left. HOWEVER, this also inverts the text in the textview inside, which is obviously not good.

    textview_inside_horizontal_layout_id.setRotationY(180f)
    

    So, we invert the textview itself once more, this will mirror the mirrored text again! So, you'll end up having something like this-

    This will make the text overflow to the right instead of left as well!

提交回复
热议问题