【问题标题】:Android Custom Navigation DrawerAndroid 自定义导航抽屉
【发布时间】:2015-04-13 17:45:40
【问题描述】:

如何创建一个类似于附加图像的导航抽屉。我已经完成了android的默认导航抽屉。

【问题讨论】:

标签: android xml android-layout


【解决方案1】:

您可以为导航抽屉使用自定义Adapter:

mDrawerList = (ListView) findViewById(R.id.left_drawer);
mDrawerList.setAdapter(new DrawerAdapter(this, R.layout.yourcustomlayout, items));

并使用getView 方法定义一个自定义适配器:

public class DrawerAdapter extends ArrayAdapter<?> {
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // customize your list item here
        // add icon for example
    }
}

应在自定义布局中设置背景和文本颜色。

更多信息here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-20
    • 1970-01-01
    • 2023-03-08
    • 2020-06-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-30
    相关资源
    最近更新 更多