有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

javascript如何创建搜索栏来搜索安卓中没有数据库的图像或文本?

我正在尝试创建一个搜索框,可以帮助从mipmap xxxhdpi文件夹中查找图像,或者创建一个搜索框,可以在没有数据库编译器的情况下查找布局中使用的字符串。sdk版本为29,min sdk版本为15

ListingPage.java

public class ListingsPage extends MainActivity   {





    Button b1;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listings_grid);

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);




        b1 = (Button) findViewById(R.id.button1);
        b1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(ListingsPage.this, malaysia_kit.class);
                startActivity(intent);
            }
        });

     .......
.......
.......

    }

}

在上面的代码中包含了多个按钮

[malaysiakit][1]


malaysia_kit.xml

<Button
            安卓:id="@+id/button1"
            安卓:layout_width="wrap_content"
            安卓:layout_height="wrap_content"
            安卓:background="@mipmap/malaysialogo"
            安卓:editable="false"
            安卓:visibility="visible"
            安卓:layout_marginTop="40dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/editText1" />


        <EditText
            安卓:id="@+id/editText1"
            安卓:layout_width="0dp"
            安卓:layout_height="wrap_content"
            安卓:layout_marginBottom="50dp"
            安卓:editable="false"
            安卓:text="Malaysia Kits"
            安卓:textAlignment="center"
            安卓:textColor="#FFF8DC"
            安卓:textSize="20sp"
            安卓:layout_marginTop="10dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/button1" />



    <EditText
        安卓:id="@+id/editText"
        安卓:layout_width="0dp"
        安卓:layout_height="wrap_content"
        安卓:editable="false"
        安卓:text="Explore Kits"
        安卓:layout_marginTop="20dp"
        安卓:textAlignment="center"
        安卓:textColor="#FFF8DC"
        安卓:textSize="25dp"
        app:layout_constraintBottom_toTopOf="@+id/listbutton"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/toolbar_id" />


    <Button
        安卓:id="@+id/button1"
        安卓:layout_width="wrap_content"
        安卓:layout_height="wrap_content"
        安卓:background="@mipmap/malaysialogo"
        安卓:editable="false"
        安卓:visibility="visible"
        安卓:layout_marginTop="40dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/editText" />



    <EditText
        安卓:id="@+id/editText2"
        安卓:layout_width="0dp"
        安卓:layout_height="wrap_content"
        安卓:layout_marginBottom="50dp"
        安卓:editable="false"
        安卓:text="Barcelona Kits"
        安卓:textAlignment="center"
        安卓:textColor="#FFF8DC"
        安卓:textSize="20sp"
        安卓:layout_marginTop="10dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/button1" />




</安卓x.constraintlayout.widget.ConstraintLayout>`enter code here`
</ScrollView>

上面是带有徽标和字符串的代码


共 (0) 个答案