Android 滚动视图如何滚动到另一个视图的底部
如何将滚动视图中的线性布局滚动到另一个视图的底部 我的视图顶部有一个日历图像视图。下面是一个滚动视图,其中包含当月的事件列表。ScrollView包含多个LinearLayouts,详细说明当月的事件。当用户通过触摸线性布局中的按钮来选择事件时,我想将当前线性布局重新定位到scrollview的顶部,我该如何实现这一点 为了简洁起见,下面是我的布局的一个简短片段Android 滚动视图如何滚动到另一个视图的底部,android,android-layout,android-widget,Android,Android Layout,Android Widget,如何将滚动视图中的线性布局滚动到另一个视图的底部 我的视图顶部有一个日历图像视图。下面是一个滚动视图,其中包含当月的事件列表。ScrollView包含多个LinearLayouts,详细说明当月的事件。当用户通过触摸线性布局中的按钮来选择事件时,我想将当前线性布局重新定位到scrollview的顶部,我该如何实现这一点 为了简洁起见,下面是我的布局的一个简短片段 <LinearLayout xmlns:android="http://schemas.android.com/ap
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/cirLinLayContainer"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg_calendar">
<RelativeLayout>
<Button
android:id="@+id/calLeft"
android:background="@drawable/btn_arrowleft_dwn"/>
<Button
android:id="@+id/calRight"
android:background="@drawable/cal_rightnav_button"/>
<ImageView android:src="@drawable/cal_september"
android:layout_width="match_parent"
android:layout_centerHorizontal="true"
android:layout_height="wrap_content" />
</RelativeLayout>
<ScrollView xmlns:foo="http://schemas.android.com/apk/res/com.demo.android"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:id="@+id/septemberCalendarScroller">
<LinearLayout android:id="@+id/sepEventLayout01"/>
<LinearLayout android:id="@+id/sepEventLayout02"/>
<LinearLayout android:id="@+id/sepEventLayout03"/>
<LinearLayout android:id="@+id/sepEventLayout04"/>
</ScrollView>
</LinearLayout>
您可以测量线性布局元素的高度,然后使用ScrollView.scrollTo()来相应地定位滚动视图。线性布局的宽度如何给出位置?你能举例说明你的建议吗?对不起,我指的是身高。更正了答案。