Я использую прокрутку. У меня мало текстовых элементов и кнопок в моем content_scrolling.xml, и я хочу, чтобы программно прокручивать/переходить к определенному текстовому виду, когда нажимается конкретная кнопка.Прокрутите до текстового поля в nestedscrollview, нажав кнопку
Кроме того, я не хочу использовать функции с координатами x-y.
В принципе, я не знаю, что делать в функции OnClick (View v).
Мой content_scrolling.xml
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.admin.test2.ScrollingActivity"
tools:showIn="@layout/activity_scrolling"
android:id="@+id/nsv">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/l1"
android:paddingLeft="40dp">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="text1"
android:id="@+id/b1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="text2"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="text3"
android:id="@+id/b3" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="text1"
android:id="@+id/t1"
android:textSize="50dp"
android:paddingTop="40dp"
android:layout_below="@+id/l1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="text2"
android:id="@+id/t2"
android:textSize="50dp"
android:layout_below="@id/t1"
android:paddingTop="@dimen/app_bar_height"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="text3"
android:id="@+id/t3"
android:textSize="50dp"
android:layout_below="@id/t2"
android:paddingTop="@dimen/app_bar_height"/>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
«Кроме того, я не хочу использовать функции с координатами x-y». Зачем?!! –
хорошо..и ищу универсальный метод, который можно назвать почти во всех моих действиях ..... координаты x-y ограничивают его конкретным действием –