11

I have a ListPopupWindow defined as below in my Android application.

    ListPopupWindow listPopupWindow;

    listPopupWindow = new ListPopupWindow(RootView.this);
    listPopupWindow.setAdapter(new ArrayAdapter<String>(RootView.this,
            R.layout.push_list_item, pushMessages));
    listPopupWindow.setAnchorView(bEvents);
    listPopupWindow.setWidth(300);
    listPopupWindow.setHeight(400);
    listPopupWindow.setModal(true);
    listPopupWindow.show();

The XML for the layout referenced above is given below..

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textColor="#FF0000"
    android:paddingLeft="6dp"
    android:textSize="12sp"
    android:maxLines="3"
    android:lines="3"
    android:ellipsize="end"
    android:textStyle="bold" />

When I get a text that is larger in size, the text just seems to clip as opposed to wrap, even though I have specified the correct attributes inside the XML. Can anyone help me understand what is going on here, and propose a solution for my problem.

Thanks..

Stefano
  • 156
  • 3
  • 14
Sharath
  • 969
  • 9
  • 30

1 Answers1

4

The main problem you should get with your xml file that it's not possible to have >2 lines + ellipsize.

You should implement you own EllipsizeTextView to support real multiline ellipsized textview.

You could find an example here and here.

Also you could find this bug here.

Community
  • 1
  • 1
dilix
  • 3,761
  • 3
  • 31
  • 55