在Android Kotlin中,您可以通过以下步骤实现具有黑色透明背景的活动,并具有白色背景的SearchView:
    
 
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setTheme(R.style.AppTheme_TransparentBackground)
    setContentView(R.layout.activity_main)
    // Add other code here
}
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setTheme(R.style.AppTheme_TransparentBackground)
    setContentView(R.layout.activity_main)
    val searchView = findViewById(R.id.searchView)
    val searchPlateId = searchView.context.resources.getIdentifier("android:id/search_plate", null, null)
    val searchPlate = searchView.findViewById(searchPlateId)
    searchPlate.setBackgroundColor(Color.WHITE)
    // Add other code here
}
  这样,您就可以实现具有黑色透明背景的活动,并具有白色背景的SearchView。