Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
222 views
in Technique[技术] by (71.8m points)

添加SearchView控件不能显示

小弟碰到一个问题,在一个布局中添加SearchView控件,怎么都不能显示,但是在别的项目添加的话就可以正常显示,或者在当前布局下添加新的按钮,也可以显示,是哪错了吗?布局代码如下

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <Button
        android:id="@+id/buttonAirport"
        android:layout_width="200px"
        android:layout_height="100px"
        android:layout_marginTop="200dp"
        android:background="@color/black"
        android:gravity="center"
        android:text="ZBAA"
        android:textSize="30px" />

    <Button
        android:id="@+id/buttonApp"
        android:layout_width="200px"
        android:layout_height="100px"
        android:layout_below="@+id/buttonAirport"
        android:background="@color/black"
        android:gravity="center"
        android:padding="0dp"
        android:text="APP"
        android:textSize="30px" />

    <Button
        android:id="@+id/buttonOther"
        android:layout_width="200px"
        android:layout_height="100px"
        android:layout_below="@+id/buttonApp"
        android:background="@color/black"
        android:gravity="center"
        android:padding="0dp"
        android:text="OTHER"
        android:textSize="30px" />

    <Button
        android:id="@+id/buttonSid"
        android:layout_width="200px"
        android:layout_height="100px"
        android:layout_below="@+id/buttonOther"
        android:background="@color/black"
        android:gravity="center"
        android:padding="0dp"
        android:text="SID"
        android:textSize="30px" />

    <Button
        android:id="@+id/buttonStar"
        android:layout_width="200px"
        android:layout_height="100px"
        android:layout_below="@+id/buttonSid"
        android:background="@color/black"
        android:gravity="center"
        android:padding="0dp"
        android:text="STAR"
        android:textSize="30px" />

    <Button
        android:id="@+id/buttonTaxi"
        android:layout_width="200px"
        android:layout_height="100px"
        android:layout_below="@+id/buttonStar"
        android:background="@color/black"
        android:gravity="center"
        android:padding="0dp"
        android:text="TAXI"
        android:textSize="30px" />

    <Button
        android:id="@+id/buttonAoi"
        android:layout_width="200px"
        android:layout_height="100px"
        android:layout_below="@+id/buttonTaxi"
        android:background="@color/black"
        android:gravity="center"
        android:padding="0dp"
        android:text="细则"
        android:textSize="30px" />

    <Button
        android:id="@+id/buttonAoi1"
        android:layout_width="200px"
        android:layout_height="100px"
        android:layout_below="@+id/buttonAoi"
        android:background="@color/black"
        android:gravity="center"
        android:padding="0dp"
        android:text="细则1"
        android:textSize="30px" />

    <androidx.appcompat.widget.SearchView
        android:id="@+id/s1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="100dp" />

    <SearchView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="150dp" />

    <FrameLayout
        android:id="@+id/pdfUiFragment"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <View
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</RelativeLayout>

如细则1按钮就是测试新加的按钮,可以正常显示,下面加上了两个SearchView,没有一个可以显示,截屏效果如图9RC~{V7code(6]E]Z0/codeDJI~6@M.png
是什么原因导致没有显示两个SearchView呢?谢谢!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.7k users

...