Android - Text is Pushed to the Left in a Spinner

前端 未结 5 904
生来不讨喜
生来不讨喜 2020-12-31 02:03

I have a spinner with a style. The style only contains a background for the spinner. The problem is,that no matter which image I use for the background, the text of the spin

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-31 02:40

    If you want to see the checkboxes in the dropdown menu while using your own layout:

    ArrayAdapter adapter = ArrayAdapter.createFromResource(
                mContext, R.array.room_list, R.layout.spinner_layout);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        yourSpinner.setAdapter(adapter);
    

    Please notice the "android" before "R.layout...." in the line where you put the drop down view resource!

提交回复
热议问题