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