Android材质设计导航视图->;项目
有人能告诉我如何在android材质设计导航视图中添加切换按钮吗 项目是从菜单项添加的 抽屉菜单项.xmlAndroid材质设计导航视图->;项目,android,xml,android-navigation,Android,Xml,Android Navigation,有人能告诉我如何在android材质设计导航视图中添加切换按钮吗 项目是从菜单项添加的 抽屉菜单项.xml 如何添加项目或如何添加切换按钮,如图所示: 试着把这个android:checkable=“true”放在项目代码中你能做的就是拍摄两张复选框的图像,一张用于选中,另一张用于未选中。 What you can do is take 2 images of checkbox, one for checked and other for unchecked. The onclick y
如何添加项目或如何添加切换按钮,如图所示:
试着把这个
android:checkable=“true”
放在项目代码中你能做的就是拍摄两张复选框的图像,一张用于选中,另一张用于未选中。
What you can do is take 2 images of checkbox, one for checked and other for unchecked.
The onclick you may toggle between images, it will give simulation of checkbox.
also you must be using drawer layout for navigation menu
xml
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/AlertDialog.AppCompat.Light"
android:fitsSystemWindows="true">
Codebehind
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
mDrawerLayout.closeDrawers();
单击可以在图像之间切换,它将模拟复选框。
此外,您必须使用抽屉布局的导航菜单
xml
代码隐藏
mListView.setOnItemClickListener(新的AdapterView.OnItemClickListener(){
@凌驾
公共虚线单击(AdapterView AdapterView,视图视图,内部位置,长l){
mDrawerLayout.closeDrawers();
What you can do is take 2 images of checkbox, one for checked and other for unchecked.
The onclick you may toggle between images, it will give simulation of checkbox.
also you must be using drawer layout for navigation menu
xml
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/AlertDialog.AppCompat.Light"
android:fitsSystemWindows="true">
Codebehind
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
mDrawerLayout.closeDrawers();