gpt4 book ai didi

android - 如何创建自定义抽屉导航?

转载 作者:搜寻专家 更新时间:2023-11-01 09:23:43 25 4
gpt4 key购买 nike

我想创建 custom navigation drawer ,但是我在 navigation 中有按钮和 EditText 。我用它来过滤。但我不能这样创建。

like this

最佳答案

实现定制相当容易

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">


<!--here is your navigation drawer just create what layout you want inside it-->

<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent">

<!--here you can create your custom view like this-->

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">


<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />


</LinearLayout>


</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>

之后,您可以简单地定义我们为其他 View 所做的 ID,并在它们上设置 onclicklistener 以获取点击事件

关于android - 如何创建自定义抽屉导航?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52464467/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com