In below image we can see that search text is black and also white and both the android version are different one is kitkat and other is oreo. i want input text in white in kitkat version too.

In below image we can see that search text is black and also white and both the android version are different one is kitkat and other is oreo. i want input text in white in kitkat version too.

 
    
     
    
    You have to create a style for your toolbar in styles.xml:
<style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.ActionBar">
    <item name="android:editTextColor">#ffffff</item>
</style>
or  
<style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.Dark">
    <item name="android:editTextColor">#ffffff</item>
</style>
and apply it in your toolbar:
android:theme="@style/ToolbarTheme"
You can also set color by having a version check.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    // Set you SearchView hint color to white for and above kitkat version
} else {
    // Set you SearchView hint color to white for other versions
}
 
    
    Try this code to change searchview text color in Java:
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:focusable="true"
    android:focusableInTouchMode="true">
    <android.support.v7.widget.SearchView
        android:id="@+id/search"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clickable="true" />
</RelativeLayout>
MainActivity.java
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.SearchView;
import android.widget.EditText;
import com.bluapp.androidview.R;
public class SearchViewActivity5 extends AppCompatActivity {
    private SearchView search;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search_view5);
        search = (SearchView)findViewById(R.id.search);
        EditText editText = (EditText)search.findViewById(android.support.v7.appcompat.R.id.search_src_text);
        editText.setTextColor(getResources().getColor(R.color.colorAccent));
    }
}
See here: https://inducesmile.com/android-programming/how-to-change-the-text-color-of-searchview-in-android/
