I solved the problem by myself! I have created a custom adapter and a custom spinner.
Code (JAVA) - (Mainsite.java)
String[] str_steuern;
resourceId = this.getResources().getIdentifier(country+"_umsatzsteuer_view", "array", this.getPackageName());
Resources steuernt = getResources();
str_steuern = steuernt.getStringArray(resourceId);
spinner_steuer = (Spinner) findViewById(R.id.spinner_steuer);
spinner_steuer.setAdapter(new adapter_spinner_steuer(Mainsite.this, R.layout.spinner_steuer_row, str_steuern));
public class adapter_spinner_steuer extends ArrayAdapter<String>{
public adapter_spinner_steuer(Context context, int textViewResourceId, String[] objects) {
super(context, textViewResourceId, objects);
}
@Override
public View getDropDownView(int position, View convertView,ViewGroup parent) {
return getCustomView(position, convertView, parent);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return getCustomView(position, convertView, parent);
}
public View getCustomView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater=getLayoutInflater();
View row=inflater.inflate(R.layout.spinner_steuer_row, parent, false);
TextView label=(TextView)row.findViewById(R.id.steuer);
label.setText(str_steuern[position]);
return row;
}
}
XML: (spinner_steuer_row.xml)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="3dip"
>
<TextView
android:id="@+id/steuer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:typeface="monospace" />
</RelativeLayout>