这是我的布局
期望 我想要显示这个
这是我的main.xml,包含group和item
如何添加项目@ + id / nav_open_account行顶部和底部
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int i;
vector<char> v;
v.push_back('a');
v.push_back('p');
v.push_back('p');
v.push_back('l');
v.push_back('e');
cout<<"\n";
cout<<"Before sort\n";
for (i=0; i<v.size(); i++) cout<< v[i];
sort(v.begin() , v.end());
cout<<"\n\n";
cout<<"After sort\n";
for (i=0; i<v.size(); i++) cout<< v[i];
cout<<"\n\n";
return 0;
}
答案 0 :(得分:3)
Take Group您想在下面加下划线
喜欢
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:id="@+id/grp1" android:checkableBehavior="single">
<item
android:id="@+id/FIRST"
android:icon="@drawable/FIRST"
android:title="FIRST" />
</group>
//tHIS sHOWING uNDERLINE bELOW
<group android:id="@+id/grp2" android:checkableBehavior="single">
<item
android:id="@+id/SECOND"
android:icon="@drawable/SECOND"
android:title="SECOND" />
</group>
//tHIS sHOWING uNDERLINE bELOW
<group android:id="@+id/THIRD" android:checkableBehavior="single">
<item
android:id="@+id/THIRD"
android:icon="@drawable/THIRD"
android:title="THIRD" />
</group>
//tHIS sHOWING uNDERLINE bELOW
<group android:id="@+id/grp4" android:checkableBehavior="single">
<item
android:id="@+id/FOUR"
android:icon="@drawable/ic_action_recommended"
android:title="FOUR" />
</group>
//tHIS sHOWING uNDERLINE bELOW
<item
android:id="@+id/FIVE"
android:icon="@drawable/FIVE"
android:title="FIVE" />
//tHIS IS nOT sHOWING uNDERLINE bELOW
<item
android:id="@+id/SIX"
android:icon="@drawable/SIX"
android:title="SIX" />
//tHIS IS nOT sHOWING uNDERLINE bELOW
<group android:id="@+id/grp5" android:checkableBehavior="single">
<item
android:id="@+id/SEVEN"
android:icon="@drawable/SEVEN"
android:title="SEVEN" />
</group>
//tHIS sHOWING uNDERLINE bELOW
</menu>
执行此操作对于线条颜色
你的xml设置主题中的导航视图
<android.support.design.widget.NavigationView
android:background="@color/profileBackground"
app:itemTextColor="@android:color/white"
app:itemIconTint="@android:color/white"
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
android:theme="@style/NavigationView" />
接受你的style.xml
<style name="NavigationView" parent="ThemeToolbar.NavigationView" >
<item name="android:listDivider">@color/yourcolor</item>
<item name="android:textColorSecondary">@color/yourcolor</item>
</style>
答案 1 :(得分:0)
如果您使用菜单NavigationView则不可能,因为它们遵循材料设计指南。
如果要实现附加(上图)图像等功能,则可以使用RecycleView或ListView或使用NavigationView添加一些布局。