I want to implement a popup menu with complex effects, one of them is to support scrolling. It seems PopupMenu and AlertDialog can not meet the requirement what I need. So I tried PopupWindow with ScrollView.
Firstly, I prepared a layout which has a simple strcture just like what ApiDemo shows:
ScrollView
LinearLayout with Vertical attribute
TextView
TextView
TextView
...
Secondarily, I new a PopupWindow with this layout and 200width/300height, show it at somewhere with showAtLocation().
I can make scrollbar displayed and has scroll effect, but TextViews in LinearLayout do NOT scroll(they are in fixed position)!
Something is wrong but I have no sense on it. (android3.0)
Thanks for any warm-heart man who can give me some tips.
-_-!!
I also faced similar issue. Some how wrapping relative layout in scrollview is not working for popupwindow.
I tried wrapping individual views under scrollview and it worked for me. PLease have a look below. Hope this helps
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="#eebd9c"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
>
<ScrollView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_below="@+id/textView2" >
<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:ems="15"
android:gravity="fill_horizontal"
android:minLines="6"
android:scrollbars="vertical"
android:singleLine="false"
android:text="Multiline text"
android:textAppearance="?android:attr/textAppearanceSmall" />
</ScrollView></RelativeLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With