开发者

Android: How do you create spinners that look the same in an activity?

Edit: Fixed it by using the same adapter on both spinners.

I have two spinners in an activity and they look completely different. One looks like its touch friendly and the other doesn't. How do I make them use the same design?

Spinner spinner1 = (Spinner) findViewById(R.id.spinner1);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
        this, R.array.raddix_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner1.setAdapter(adapter);

Spinner spinner2 = (Spinner) findViewById(R.id.spinner2);
ArrayAdapter<CharSequence> adapter2 = ArrayAdapter.createFromResource(
        this, R.array.raddix_array, android.R.layout.simple开发者_开发知识库_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner2.setAdapter(adapter2);

spinner1.setOnItemSelectedListener(this);
spinner2.setOnItemSelectedListener(this);


I would imagine that this is somewhere in the XML that defines the two spinners. Ensure that all of the relevant properties are the same within the XML (such as enabled).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜