Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何获取ListView节标题和项目的默认视图?_Java_Android - Fatal编程技术网

Java 如何获取ListView节标题和项目的默认视图?

Java 如何获取ListView节标题和项目的默认视图?,java,android,Java,Android,我想复制Gmail中侧边栏/操作栏下拉列表的外观,也就是说,右边有褪色数字的所有标题和项目。我知道我需要创建自己的SpinnerAdapter,我已经开始了。我陷入困境的是如何获得这些标准视图,并使用I guess view.findviewbyd将所需的文本放到正确的子视图中。谁能给我指出正确的方向吗 public View getDropDownView(int position, View convertView, ViewGroup parent) { Context conte

我想复制Gmail中侧边栏/操作栏下拉列表的外观,也就是说,右边有褪色数字的所有标题和项目。我知道我需要创建自己的SpinnerAdapter,我已经开始了。我陷入困境的是如何获得这些标准视图,并使用I guess view.findviewbyd将所需的文本放到正确的子视图中。谁能给我指出正确的方向吗

public View getDropDownView(int position, View convertView, ViewGroup parent) {
    Context context = parent.getContext();
    Object item = getItem(position);

    LayoutInflater inflater = (LayoutInflater)context.getSystemService
              (Context.LAYOUT_INFLATER_SERVICE);

    if (item instanceof String) {
        String headerText = (String) item;
        // TODO: inflate the ICS section header view,
        // populate with headerText, and return
    } else {
        ListItem listItem = (ListItem) item;
        // TODO: inflate the ICS text/number view, populate with
        // listItem.getText()/getNumber() and return            
    }
}
以下是我所说内容的视觉参考: