I have a simple ScrollView in a layout that displays an About Box in a dialog format. So it just pops up on the phone screen in a dialog. The only way for the user to close the box is to click the back button (it is an intent).
Do I have a way of adding a close button to the box or could I have the user hit the box on the screen with their finger and close it?
Here is my xml:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:screenOrientation="portrait"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip" >
<TextView
android:id="@+id/about_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_text" />
</ScrollView>
That’s what any Android user would want to do. Anyway, if you want to provide the “close with button” functionality just keep in mind this: ScrollView cannot contain more than one item, so you will have to wrap both
TextViewand Button inside aLinearLayoutor something.But, my suggestion is that you should build an
AlertDialog, which can be automatically configured with an “OK” button which will close the dialog.