Android: Cannot style spinner divider

前端 未结 4 1778
傲寒
傲寒 2020-12-05 20:01

I\'m trying to create a theme for my first Android app, and it is driving me round the bend. I finally managed to figure out how to style items in a dropdown list, but now I

4条回答
  •  情书的邮戳
    2020-12-05 20:16

    I have a very simple Activity with the Spinner and it works for the following. The only difference I see is that you have a 3dp and I don't have that at all.

    
    
    
    
    

    and in my Activity I have:

        Spinner spinner = (Spinner) findViewById(R.id.spinner);
        List list = new ArrayList();
        list.add("list 1");
        list.add("list 2");
        list.add("list 3");
        ArrayAdapter dataAdapter = new ArrayAdapter(this,
                android.R.layout.simple_spinner_item, list);
        dataAdapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
        spinner.setAdapter(dataAdapter);
    

    and then for the main layout I have the following XML:

    
        
        
    
    

    Here is the screenshot

    sample activity screnshot

    If you can't get it to work from there, I can push up the entire thing to a github repo for you.

提交回复
热议问题