我是Android的新手,我正在尝试创建一个微调器,我在微调器上有问题,我想使用文本中心,这是我项目的结果
我的activity_main.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<Spinner
android:id="@+id/nominal_pulsa"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"
android:entries="@array/nominal"
android:layout_gravity="top"/>
</LinearLayout>
我的MainActivity.java
package com.spinner;
import android.os.Bundle;
import android.app.Activity;
import android.widget.Spinner;
public class MainActivity extends Activity {
Spinner spin;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
my strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Spinner</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
<string-array name="nominal">
<item>Pilih Nominal</item>
<item>1.000</item>
<item>2.000</item>
<item>3.000</item>
<item>4.000</item>
<item>5.000</item>
<item>6.000</item>
<item>7.000</item>
<item>8.000</item>
<item>9.000</item>
<item>10.000</item>
<item>20.000</item>
<item>25.000</item>
<item>30.000</item>
<item>50.000</item>
<item>60.000</item>
<item>100.000</item>
</string-array>
</resources>