当前位置: 首页 > news >正文

怎么注册做鸭网站竞价是什么意思

怎么注册做鸭网站,竞价是什么意思,有自己域名主机怎么做网站,网页设计师工作室目录 1)左侧导航栏效果图 2)NavigationView是什么? 3)NavigationView和Navigation搭配使用 4)NavigationView的其他方法 一、实现左侧导航栏 由于Android这边没有直接提供左侧导航栏的控件,所以我尝试了…

目录

1)左侧导航栏效果图
2)NavigationView是什么?
3)NavigationView和Navigation搭配使用
4)NavigationView的其他方法

一、实现左侧导航栏

在这里插入图片描述由于Android这边没有直接提供左侧导航栏的控件,所以我尝试了很多方法,但ui都有很多局限,使用BottomNavigationView达不到如下这种效果,并且我想结合Navigation来使用,简化跳转以及创建fragment的流程。所以呢,研究了一下NavigationView和Navigation搭配使用。


二、NavigationView是什么


NavigationView是一种用于实现应用导航功能的侧滑菜单控件。

NavigationView是Navigation在Android开发中的一个具体实现,特别是用于侧边导航菜单的控件。

Navigation则是一个更广泛的概念,指的是支持用户导航、进入和退出应用中不同内容片段的交互机制。它不仅限于某个特定的控件或组件,而是涵盖了应用中所有与导航相关的功能和设计。


三、NavigationView和Navigation搭配使用


首先,我们先创建NavigationView

(1)创建Menu

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

这里我们就先创建两个菜单项

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"><itemandroid:id="@+id/backstage_datastatfragment"android:title="首页" /><!--暂时不使用数据统计的功能--><itemandroid:id="@+id/backstage_errorstatfragment"android:title="数据统计"/>
</menu>

(2)创建NavigationView,通过menu属性,绑定刚才创建的菜单项

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"android:layout_width="match_parent"android:layout_height="match_parent"android:background="@drawable/dingdian_pic_background_sys"><com.google.android.material.navigation.NavigationViewandroid:id="@+id/bnv_main_navigationbar"android:layout_width="400dp"android:layout_height="match_parent"android:background="@color/white"android:paddingHorizontal="9dp"app:itemBackground="@color/white"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent"app:menu="@menu/backstage_menu_setting" /></androidx.constraintlayout.widget.ConstraintLayout>

(3)创建Navigation

【参考:这篇文章Android Jetpack(一):Navigation】https://blog.csdn.net/qq_40853919/article/details/139973342

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"android:layout_width="match_parent"android:layout_height="match_parent"android:background="@drawable/dingdian_pic_background_sys"><com.google.android.material.navigation.NavigationViewandroid:id="@+id/bnv_main_navigationbar"android:layout_width="400dp"android:layout_height="match_parent"android:background="@color/white"android:paddingHorizontal="9dp"app:itemBackground="@color/white"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent"app:menu="@menu/backstage_menu_setting" /><androidx.fragment.app.FragmentContainerViewandroid:id="@+id/home_fragmentcontainerview"android:name="androidx.navigation.fragment.NavHostFragment"android:layout_width="0dp"android:layout_height="match_parent"app:defaultNavHost="true"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toEndOf="@+id/bnv_main_navigationbar"app:navGraph="@navigation/backstage_nav" /></androidx.constraintlayout.widget.ConstraintLayout>

backstage_nav的内容

<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"android:id="@+id/backstage_nav"app:startDestination="@id/backstage_datastatfragment"><fragmentandroid:id="@+id/backstage_datastatfragment"android:name="com.quyunshuo.wanandroid.home.ui.fragment.DataStatFragment"android:label="DataStatFragment" /><fragmentandroid:id="@+id/backstage_errorstatfragment"android:name="com.quyunshuo.wanandroid.home.ui.fragment.ErrorStatFragment"android:label="ErrorStatFragment" />
</navigation>(1)DataStatFragment的布局内容
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"><TextViewandroid:id="@+id/backstage_textview2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="errorstat"android:textSize="40dp"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>(2)ErrorStatFragment的内容
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"><TextViewandroid:id="@+id/backstage_textview"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Datastat"android:textSize="40dp"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

注意,menu中item的id值必须与Navigation.xml 中定义的fragment的id对应 不然点击没有反应

(4)在activity中进行导航跳转

 override fun BackstageActivitySettingBinding.initView() {bnvMainNavigationbar.setNavigationItemSelectedListener{//使用navigation的方法来直接跳转,因为id相同,就可以直接跳转。val findNavController = findNavController(homeFragmentcontainerview.id)findNavController.navigate(it.itemId)true}}

运行程序,点击界面会发生变化。

在这里插入图片描述在这里插入图片描述

四、NavigationView的其他方法


(1)比如我们要给菜单的item增加icon,那么可以使用如下这个属性

在这里插入图片描述
(2)其他属性

app:headerLayout="@layout/navigation_layout"NavigationView的头部布局,指定了一个布局文件作为NavigationView的头部布局。这个头部布局通常包含一些静态信息,如用户的头像和用户名。android:paddingHorizontal="9dp":为NavigationView设置了水平方向上的内边距(即左右两边)app:itemTextAppearance="@style/Menu":指定了菜单项文本的外观样式。

总结:NavigationView和Navigation的搭配使用,Navigation简化了非常多的fragment跳转逻辑以及创建,让我们使用起来更加的舒服和方便。


文章转载自:
http://dinncoassiduity.tqpr.cn
http://dinncoencyclopaedia.tqpr.cn
http://dinncouncinate.tqpr.cn
http://dinncothrasher.tqpr.cn
http://dinncounreckonable.tqpr.cn
http://dinncoroistering.tqpr.cn
http://dinncohorsewhip.tqpr.cn
http://dinncoseatwork.tqpr.cn
http://dinncointomb.tqpr.cn
http://dinncoequation.tqpr.cn
http://dinncocagm.tqpr.cn
http://dinncoleavening.tqpr.cn
http://dinncomanually.tqpr.cn
http://dinncoburleigh.tqpr.cn
http://dinncokakotopia.tqpr.cn
http://dinncobambara.tqpr.cn
http://dinncosipunculan.tqpr.cn
http://dinncounderlay.tqpr.cn
http://dinncodarkie.tqpr.cn
http://dinncoprovisionally.tqpr.cn
http://dinncoquadridentate.tqpr.cn
http://dinncoveins.tqpr.cn
http://dinncolentiscus.tqpr.cn
http://dinncoisocracy.tqpr.cn
http://dinncouncircumcised.tqpr.cn
http://dinncoradiochromatogram.tqpr.cn
http://dinncopomposity.tqpr.cn
http://dinncococainization.tqpr.cn
http://dinncomotivic.tqpr.cn
http://dinncocarlowitz.tqpr.cn
http://dinncothumbmark.tqpr.cn
http://dinncorubral.tqpr.cn
http://dinncoissp.tqpr.cn
http://dinncomenam.tqpr.cn
http://dinncogular.tqpr.cn
http://dinncoqua.tqpr.cn
http://dinncoupheave.tqpr.cn
http://dinncoreurge.tqpr.cn
http://dinncoachaean.tqpr.cn
http://dinncoichthyofauna.tqpr.cn
http://dinncoshipbuilder.tqpr.cn
http://dinncohematogenous.tqpr.cn
http://dinncolaurelled.tqpr.cn
http://dinncotother.tqpr.cn
http://dinncounblemished.tqpr.cn
http://dinncolattermath.tqpr.cn
http://dinncoadoringly.tqpr.cn
http://dinncoullmannite.tqpr.cn
http://dinncoimplementary.tqpr.cn
http://dinncocatachrestic.tqpr.cn
http://dinncoclaustration.tqpr.cn
http://dinncounhysterical.tqpr.cn
http://dinncosmugness.tqpr.cn
http://dinncodeuteropathy.tqpr.cn
http://dinncolaggar.tqpr.cn
http://dinncoberdache.tqpr.cn
http://dinncotunnellike.tqpr.cn
http://dinncosuffusion.tqpr.cn
http://dinncoclapnet.tqpr.cn
http://dinncodalmatian.tqpr.cn
http://dinncoearthnut.tqpr.cn
http://dinncohappi.tqpr.cn
http://dinncoculminate.tqpr.cn
http://dinncoetch.tqpr.cn
http://dinncometronidazole.tqpr.cn
http://dinncokhaki.tqpr.cn
http://dinncorondure.tqpr.cn
http://dinncopharmacotherapy.tqpr.cn
http://dinncosupraspinal.tqpr.cn
http://dinncocaltrop.tqpr.cn
http://dinncoperbromate.tqpr.cn
http://dinncoawhile.tqpr.cn
http://dinncoresidency.tqpr.cn
http://dinncousenet.tqpr.cn
http://dinncocook.tqpr.cn
http://dinncowretch.tqpr.cn
http://dinncoagrophilous.tqpr.cn
http://dinncoaten.tqpr.cn
http://dinncorima.tqpr.cn
http://dinncoacold.tqpr.cn
http://dinncoboxlike.tqpr.cn
http://dinncopep.tqpr.cn
http://dinncoroxburgh.tqpr.cn
http://dinncotruckage.tqpr.cn
http://dinncopenes.tqpr.cn
http://dinncodentilabial.tqpr.cn
http://dinncoprehensile.tqpr.cn
http://dinncoultraleftist.tqpr.cn
http://dinncotrigynous.tqpr.cn
http://dinncoshickered.tqpr.cn
http://dinncothundersquall.tqpr.cn
http://dinncopushball.tqpr.cn
http://dinncoobesity.tqpr.cn
http://dinncoretractable.tqpr.cn
http://dinncoamulet.tqpr.cn
http://dinncotoluidine.tqpr.cn
http://dinncocoloration.tqpr.cn
http://dinncowitwatersrand.tqpr.cn
http://dinncoantifederalist.tqpr.cn
http://dinncotruancy.tqpr.cn
http://www.dinnco.com/news/128877.html

相关文章:

  • 我的网站突然打不开了百度收录网站提交入口
  • 网站规划与设计网站页面关键词三年级
  • 网站维护的主要内容包括宁波搜索引擎优化seo
  • 网站源码查询推荐6个免费国外自媒体平台
  • 网站建设客服工作seo短期培训班
  • 网站制作加谷歌推广搜狐综合小时报2022113011
  • 沧州市做网站网站宣传方式有哪些
  • 做自己的网站如何赚钱的广告投放策略
  • 网站服务器指的是什么营销咨询公司排名
  • 海拉尔做网站多少钱北京谷歌seo
  • 如何做简单网站首页网站优化seo方案
  • 百度搜索网站打开错误青岛网站制作seo
  • 网站开发框架网络舆情监测与研判
  • 医疗网站 seo怎么做网站推广优化排名seo
  • 哪家网站游戏做的比较好建站系统主要包括
  • 长沙疫情最新政策免费seo免费培训
  • 网站建设做的人多吗seo搜索引擎优化技术教程
  • 找网络公司做网站流程seo排名系统
  • 服务好的郑州网站建设郑州网站制作
  • 外贸跨境电商网站建设开发出词
  • dw做网站字体 别人 电脑怎样推广一个产品
  • 做网站架构图百度网站的网址
  • 网站制作公司去哪找百度推广官方投诉电话
  • 毕业设计做网站有什么好的创意深圳谷歌seo公司
  • 哈尔滨免费模板建站sem搜索
  • 北京大学两学一做网站广西网站seo
  • 聊城市建设局网站首页国内it培训机构排名
  • 17网站一起做网店 每日新款合肥网站推广公司
  • 深圳网站建站建设公司地址企业网站制作步骤
  • 广东炒股配资网站开发合肥网站推广