Android: Last line of textview cut off

后端 未结 20 1310
北荒
北荒 2020-11-28 02:46

I have a horizontal LinearLayout containing a TextView followed by a Spinner next to it. This LinearLayout is dynamically

20条回答
  •  执笔经年
    2020-11-28 03:27

    I finally fixed it!

    I try to add String to the TextView in Service and then call scrollTo(), the last line be cut off!

    The scrollTo() should be call in "Runnable", like:

    private ScrollView mScrollView;
    public void scrollToBottom()
    {
        mScrollView = (ScrollView) findViewById(R.id.debug_textview_scrollview);
        mScrollView.post(new Runnable()
        {
            public void run()
            {
                mScrollView.fullScroll(View.FOCUS_DOWN);
            }
        });
    }
    

    I think it because in the monent of call scrollTo() in service, the update of TextView is not ready.

提交回复
热议问题