PlacePicker doesn't pick up material theme

后端 未结 3 1411
既然无缘
既然无缘 2021-01-17 21:30

I am using a PlacePicker library from Google Play Services which starts up a new activity. The new activity/picker has a toolbar (actionbar) which is not styled by default.<

3条回答
  •  情深已故
    2021-01-17 22:17

    To fix issues toolbar theme android Place Picker on OS under Lollipop

    PlacePicker.IntentBuilder intentBuilder = new PlacePicker.IntentBuilder(); 
    Intent intent = intentBuilder.build(getActivity()); 
        // if Build version sdk is under Lollipop, add intent extra
        (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            intent.putExtra("primary_color", getResources().getColor(R.color.colorPrimary));
            intent.putExtra("primary_color_dark", getResources().getColor(R.color.colorPrimaryDark));
        }
    
    //start intent
    startActivityForResult(intent, REQUEST_PLACE_PICKER_CODE);
    

提交回复
热议问题