C# Xamarin滚动视图应该跳到底部

C# Xamarin滚动视图应该跳到底部,c#,android,xml,xamarin,C#,Android,Xml,Xamarin,我有一个ViewSwitcher,其中有一个TextView,周围有一个ScrollView以获得滚动条。我需要它自动滚动到底部。有什么财产可以这样做吗?我已经试过在底部施加重力了 这是我的密码: <ScrollView android:id="@+id/SCROLLER_ID" android:layout_width="fill_parent" android:layout_height="wrap_content" an

我有一个
ViewSwitcher
,其中有一个
TextView
,周围有一个
ScrollView
以获得滚动条。我需要它自动滚动到底部。有什么财产可以这样做吗?我已经试过在底部施加重力了

这是我的密码:

<ScrollView
        android:id="@+id/SCROLLER_ID"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical"
        android:fillViewport="true">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/textView1"
            android:clickable="true"
            android:fadeScrollbars="false"
            android:scrollbars="vertical"
            android:scrollbarAlwaysDrawVerticalTrack="true"
            android:verticalScrollbarPosition="right"
            android:longClickable="true"
            android:nestedScrollingEnabled="true"
            android:layout_marginRight="15.5dp"
            android:layout_marginLeft="0.0dp" />
    </ScrollView>
</ViewSwitcher>

不过,我认为在AXML中无法做到这一点。在我看来,你必须在你的代码背后这样做。在布局文件的相应活动中,请将以下代码段放入您的
OnCreate
覆盖中:

var scrollView = FindViewById<ScrollView>(Resource.Id.SCROLLER_ID);
scrollView.Post(() =>
{
    scrollView.FullScroll(FocusSearchDirection.Down);
});

你能提供你迄今为止所做工作的代码吗?@Benjamin我提供了代码!
var scrollView = FindViewById<ScrollView>(Resource.Id.SCROLLER_ID);
scrollView.Post(() =>
{
    scrollView.ScrollTo(0, scrollView.Bottom);
});