DialogFragment中的Spinner选项(ABS的IcsSpinner)显示为截断 [英] Spinner options (an IcsSpinner from ABS) inside DialogFragment are displayed truncated

查看:339
本文介绍了DialogFragment中的Spinner选项(ABS的IcsSpinner)显示为截断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 DialogFragment 中显示 Spinner 时出现以下问题。



Spinner 被显示,当键盘出现时它只显示OK。



Spinner 实际上是一个带有以下代码的自定义类:

  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);

}
}

我该如何解决? / p>

提前感谢。




解决方案

转到 com.actionbarsherlock.internal.widget.IcsSpinner 源代码

查找 DropdownPopup popup = new DropdownPopup(context,attrs,defStyle);

替换为 DropdownPopup popup = new DropdownPopup(context.getApplicationContext(),attrs,defStyle);



适用于我;



:)


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.

解决方案

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;

:)

这篇关于DialogFragment中的Spinner选项(ABS的IcsSpinner)显示为截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆