I am new to android. I am trying to implement a scrollable popup on Android.
If I do a scroll view My view displays an error message ScrollView may contain only one direct child element (Details)
here is my code
private PopupWindow pwindo;
private void initiatePopupWindow() {
try {
LayoutInflater inflater = (LayoutInflater) About.this
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.screen_popup,
(ViewGroup) findViewById(R.id.popup_element));
pwindo = new PopupWindow(layout,700,1000, true);
btnClosePopup = (Button) layout.findViewById(R.id.btn_close_popup);
btnClosePopup.setOnClickListener(cancel_button_click_listener);
} catch (Exception e) {
e.printStackTrace();
}
}
private OnClickListener cancel_button_click_listener = new OnClickListener() {
public void onClick(View v) {
pwindo.dismiss();
}
};
And my look
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="vertical"
android:id="@+id/popup_element">
<TextView/>
<TextView/>
<TextView/>
<ImageButton/>
<ImageButton/>
.
.
.
.
</ScrollView>
Thanks in advance.
source
share