Spinner options (an IcsSpinner from ABS) inside DialogFragment are displayed truncated

扶醉桌前 提交于 2019-12-24 14:43:05

问题


I have the following problem displaying a Spinner inside a DialogFragment.

The Spinner is displayed cut and it's only displayed OK when the keyboard appears.

The Spinner is actually a custom class with the following code:

import android.content.Context;
import android.util.AttributeSet;

import com.actionbarsherlock.internal.widget.IcsSpinner;

public class CustomIcsSpinner extends IcsSpinner {

  public CustomIcsSpinner(Context context, AttributeSet attrs) {
    super(context, attrs, com.actionbarsherlock.R.attr.actionDropDownStyle);

  }

  public CustomIcsSpinner(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

  }
}

How can I fix this?

Thanks in advance.


回答1:


Go to com.actionbarsherlock.internal.widget.IcsSpinner source code.
Find DropdownPopup popup = new DropdownPopup(context, attrs, defStyle);
Replace with DropdownPopup popup = new DropdownPopup(context.getApplicationContext(), attrs, defStyle);

Works for me;

:)



来源:https://stackoverflow.com/questions/15850337/spinner-options-an-icsspinner-from-abs-inside-dialogfragment-are-displayed-tru

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!