小编Cam*_*007的帖子

材质 3 搜索栏

我正在尝试使用新的 Material 3 搜索栏(https://github.com/material-components/material-components-android/blob/master/docs/components/Search.md)。所以我是这样实现的

<com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <com.google.android.material.search.SearchBar
            android:id="@+id/searchBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/searchbarHint"/>
    </com.google.android.material.appbar.AppBarLayout>
Run Code Online (Sandbox Code Playgroud)

围绕这个我有一个LinearLayoutin a CoordinatorLayout。我在正确的位置看到搜索栏,并且我实现的点菜单也可以工作,但是当我单击搜索栏时它没有反应。这就像单击一个按钮(我看到单击反馈)。

我只是它显示了一个键盘,这样我就可以输入搜索查询。但事实并非如此。

android material-components-android material3

6
推荐指数
1
解决办法
4031
查看次数