I tried to follow advices here: How to change spinner text size and text color? and here: http://tekeye.uk/android/examples/ui/changing-android-spinner-text-size
but without success.
First I tried to re-use/change the android.R.layout resources. I go to the definition by clicking in Android Studio the Ctrl + B key combination on android.R.layout.simple_spinner_item.xml.
I find the path to the resource file out there. I copied the resource file and added a new layout spinner_item.xml in my Package.R.layout folder ( which has this path: /home/myusername/Android/Sdk/platforms/android-25/data/res/layout) and change the textColor of textview:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android".
android:id="@android:id/text1"
style="?android:attr/spinnerItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="18sp"
android:ellipsize="marquee"
android:textAlignment="inherit"/>
and then call it in adapter:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
spinner2 = (Spinner) findViewById(R.id.blokkora);
//Create an ArrayAdapter using the string array and a default spinner layout
ArrayAdapter<CharSequence> adapter2 = ArrayAdapter.createFromResource(this,
R.array.BlokkoraSorszama, android.R.layout.my_spinner);
// Specify the layout to use when the list of choices appears
adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// Apply the adapter to the spinner
spinner2.setAdapter(adapter2);
}
but I get 'Can not resolve symbol 'my_spinner' out there. Why?
Then I tried also to make my_spinner.xml in the project's explorer of this project and use it as adviced in the link above, but get again the above error message.
Finally I tried to add my_stiles.xml too and use it as adviced but still get the above mentioned error message. What am I missing here?