In my Android app, I have a few views (Buttons, EditTexts etc.) not visible initially. These are visible only on a particular button click event. I wish to move the scrollview to the end of these views so that these are visible to the user.
The relevant portion of the layout file:
<ScrollView...>
<RelativeLayout android:id="@+id/RelDevDet"
android:layout_width="fill_parent" android:layout_height="wrap_content">
.
.
.
<ImageButton android:id="@+id/ibRateApp"
android:layout_toRightOf="@id/tvRateApp"
android:layout_alignTop="@id/tvRateApp"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/arrow_up" android:clickable="true"
android:layout_marginRight="5dp"
android:paddingBottom="10dp"
/>
<RatingBar android:id="@+id/rtApp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/tvRateApp"
android:layout_marginLeft="5dp" android:visibility="gone"/>
<EditText android:layout_width="fill_parent"
android:id="@+id/etRateApp"
android:layout_height="wrap_content"
android:lines="3"
android:layout_below="@+id/rtApp"
android:layout_marginRight="5dp"
android:layout_alignLeft="@+id/tvDevWeb"
android:visibility="gone" />
<Button android:id="@+id/btSubRat" android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_below="@+id/etRateApp" android:layout_margin="5dp" android:text="Submit" android:visibility="gone"/>
</RelativeLayout>
</ScrollView>
The onclicklistener for the button is:
public void onClick(View v) {
if(v.getId()== R.id.ibRateApp){
Log.d("amit","scroll end");
rtApp.setVisibility(View.VISIBLE);
etRateApp.setVisibility(View.VISIBLE);
//How to get the scrollview move to the end of the page here??
}
}
scroll.fullScroll(View.FOCUS_DOWN);
This fixed it for me.