getting the following error Type mismatch: cannot convert from android.support.v7.app.ActionBar.LayoutParams to android.app.ActionBar.LayoutParams
LayoutInflater inflater = (LayoutInflater) getActionBar().getThemedContext().getSystemService(LAYOUT_INFLATER_SERVICE);
final View spinnerView = inflater.inflate(R.layout.layout_spinner, null);
Spinner spinner = (Spinner) spinnerView.findViewById(R.id.my_spinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.Location, R.layout.spinner_item);
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
spinner.setAdapter(adapter);
// spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
//
// @Override
// public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
// // Do whatever you want with your selected item. You can get it as: parent.getItemAtPosition(position);
// }
//
// @Override
// public void onNothingSelected(AdapterView<?> parent) {}
// });
getActionBar().setIcon(getResources().getDrawable(R.drawable.loc));//set your actionbar logo
getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE );
LayoutParams layoutParams = new ActionBar.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
layoutParams.gravity = Gravity.RIGHT; // set your layout's gravity to 'right'
getActionBar().setCustomView(spinnerView, layoutParams); //place your layout on the actionbar
i am getting error at new ActionBar.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
please help...i am not able to solve the error as i am new to android