Android Question How to lengthen the scrollviewContentHeight?

Hi, everyone!
I am using a bbcodeview to show a long text after which there is a button added to the bbcodeview. I found that the button is shortened, so I have to lengthen the bbcodeview.sv.ScrollviewContentHeight.
My current thinking is to get the btn.top+btn.height to fix this. Howerver, it is not the right size.
But I have no idea how to get the height right.

My code is like this:
B4X:
private Sub showContent
    'get the data of the item chosed by user
    diary.Initialize 'diary is a map that stores user's data
    diary=B4XPages.GetPage("page2_2").As(page2_2).ItemToViewDetail
    
    
    Dim tick As Long=diary.Get("tick")
    Dim year As Int=DateTime.GetYear(tick)
    Dim month As Int=DateTime.GetMonth(tick)
    Dim dayOfMonth As Int=DateTime.GetDayOfMonth(tick)
    Dim time As String=DateTime.Time(tick)
    Dim btn1 As Button
    
    'add a button to bbcodeview
    btn1.Initialize("btn1")
    BBCodeView1.Views.Put("btn1",btn1)
    
    'set btn1 style and size
    btn1.Text="Record Mood"
    btn1.SetColorAnimated(0,Colors.Red,Colors.Red)
    btn1.Width=300dip
    btn1.Height=50dip
    btn1.TextColor=Colors.White
    btn1.TextSize=25
    
    
    BBCodeView1.Text=$"[b][textsize=25]在${year}年${month}月${dayOfMonth}日${time}
    
you felt:[/textsize][/b]
    [textsize=20]${diary.Get("emotions")}[/textsize]
                                                                                       'These blank lines are used to test if my app works properly when the text is very long
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
[b][textsize=25]Location:[/textsize][/b]
    [textsize=20]${diary.Get("place")}[/textsize]
    
[b][textsize=25]What happened:[/textsize][/b]
    [textsize=20]${diary.Get("event")}[/textsize]
    
[b][textsize=25]Your thoughts at the time:[/textsize][/b]
    [textsize=20]${diary.Get("thoughts")}[/textsize]
    
    [view=btn1/] 
    "$
'calculate and set the contentheight according to the position of btn1'
BBCodeView1.sv.ScrollViewContentHeight=btn1.Top+btn1.Height+BBCodeView1.Padding.Top+BBCodeView1.Padding.Bottom


 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…