I have a scroll view in my activity view,in this layout i will add dynamic content in 'ucontent','pcontent' by inflating another layout in a loop( the number of inflated layout changes with time).I need to scroll the scrollview sv so that the tiltle with 'titlep' comes in top when i click 'titlep'.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/sv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#232323"
android:scrollbars="none" >
<LinearLayout
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="#232323"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/titleu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#D84A49"
android:orientation="horizontal"
android:paddingBottom="7dp"
android:paddingTop="7dp" >
<ImageView
android:id="@+id/toggleu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:src="@drawable/toggleu" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="title1....."
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:id="@+id/ucontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
</LinearLayout>
<LinearLayout
android:id="@+id/titlep"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="0dp"
android:layout_marginTop="5dp"
android:background="#D84A49"
android:orientation="horizontal"
android:paddingBottom="7dp"
android:paddingTop="7dp" >
<ImageView
android:id="@+id/togglep"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:src="@drawable/toggleu" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight=".1"
android:text="title2...."
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:id="@+id/pcontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
How can i do that in my code or in xml?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.