【问题标题】:Spinner Layout Closed different From Layout of Each RowSpinner Layout Closed 与每行的布局不同
【发布时间】:2013-03-29 05:17:07
【问题描述】:

关闭时我的微调器的布局采用为微调器的每一行配置的布局布局。

每一行的布局是在 getCustomView 方法中定义的,因为我使用的是微调器的自定义适配器,这里是定义:

public View getCustomView(int position, View convertView, ViewGroup parent) {

            LayoutInflater inflater=getLayoutInflater();
            View row=inflater.inflate(R.layout.row, parent, false);  //here is the layout for each row -> R.layout.row

            //there are more things here but doesnt matter for the question..


}

在那个布局(row.xml)上,我有顶部和底部的边距,因为我想在选项之间留出一些空间。但是微调器的按钮本身,我的意思是,微调器的布局也在关闭时有边距。它看起来比我想要的要大。

可以定义不同的布局吗? 我尝试使用较小的高度在 xml 中制作微调器布局,但随后我可以清楚地看到该选项..因为它有边距..

我说清楚了吗? 提前非常感谢..如果有人不明白我可以解释得更好。 谢谢;)

【问题讨论】:

标签: layout drop-down-menu row spinner


【解决方案1】:

Finnaly 找到了解决这个问题的方法 :) 不知道 getDropDownView 用于下拉布局,而 getView 用于单个布局,在关闭的微调器处...

这里的解决方案:Android Spinner with different layouts for "drop down state" and "closed state"?

【讨论】:

    猜你喜欢
    • 2019-01-25
    • 2011-07-21
    • 2013-11-12
    • 2011-06-14
    • 1970-01-01
    • 1970-01-01
    • 2014-06-15
    • 2023-03-25
    • 1970-01-01
    相关资源
    最近更新 更多