Java Android在同一页面上滚动到ID
我在谷歌搜索了一个在同一页面上按ID滚动到元素的例子,但没有成功。我想知道下面的例子是如何实现的Java Android在同一页面上滚动到ID,java,android,android-layout,Java,Android,Android Layout,我在谷歌搜索了一个在同一页面上按ID滚动到元素的例子,但没有成功。我想知道下面的例子是如何实现的 <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="@+id/pressMe"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Press me to scroll to A">
<ImageView
android:id="@+id/scrollToMe"
android:layout_height="100dp"
android:layout_width="fill_parent"
android:layout_marginTop="2000dp"
android:background="#f00">
</LinearLayout>
</ScrollView>
您可以将注意力集中在该视图上,我认为它会自动滚动到该视图
我相信您还可以获取所需视图的坐标并滚动到它们。您可以关注该视图,我认为它会自动滚动到该视图 我相信你也可以得到你需要的视图坐标并滚动到它们