• 10
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

Pretty straight-forward, how do I change the color of the line along the bottom of a SearchView in Android? I've tried, queryBackground, background, and various other things but cant seem to get it in XML. Im happy doing it programmatically or in XML. Just want it to work!

SearchView example

Use Below method to change colour of bottom line of SearchView.

Here I add Blue Colour as bottom Line

private void customizeSearchView() {
        int searchTextId = getResources().getIdentifier("android:id/search_src_text", null, null);
        EditText searchBox = ((EditText) searchView.findViewById(searchTextId));
        searchBox.setBackgroundColor(Color.WHITE);
        searchBox.getLayoutParams().height = LinearLayout.LayoutParams.MATCH_PARENT;
        int search_plateId = getResources().getIdentifier("android:id/search_plate", null, null);
        View mSearchPlate = ((View) searchView.findViewById(search_plateId));
        mSearchPlate.setBackgroundColor(Color.BLUE);

        int searchCloseImageId = getResources().getIdentifier("android:id/search_close_btn", null, null);
        ImageView searchClose = ((ImageView) searchView.findViewById(searchCloseImageId));// change color
        searchClose.setBackgroundColor(Color.WHITE);
    }
  • 1
Reply Report
      • 2
    • This is the answer, thanks. Worth noting that you need to fill the EditText with a background color also (like you have here), otherwise the entire searchview turns the color of the searchplate.

hi try this it may help you

  android.support.v7.widget.SearchView searchView=findViewById(R.id.search_view);
    View v = searchView.findViewById(android.support.v7.appcompat.R.id.search_plate);
    v.setBackgroundColor(Color.parseColor("color code"));
  • 0
Reply Report
androidx.appcompat.widget.SearchView searchView = findViewById(R.id.Search_Categorie);
View v = searchView.findViewById(androidx.appcompat.R.id.search_plate);
v.setBackgroundColor(Color.parseColor("#ffffff"));
  • 0
Reply Report