当我的微调器被显示或点击时,我看不到任何东西

时间:2015-09-07 13:32:28

标签: android custom-controls android-spinner

我有一个自定义微调器。我已经尽可能地使它工作,但我没有看到任何值的初始值或下拉,没有响应,没有错误。

我的自定义xml。

View

我的customAdapter类。

public class Game_AddFixtures_SpinnerAdapter extends ArrayAdapter {

<?xml version="1.0" encoding="utf-8"?>
    <TextView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="20sp"
        android:gravity="left"
        android:textColor="@color/white"
        android:padding="5dip" />

我的活动呼叫代码

private Context context;
private ArrayList<String>itemList;
private Activity activity;
private LayoutInflater inflater;
public Game_AddFixtures_SpinnerAdapter(Context context, int textViewResourceId, ArrayList<ArrayList<String>> itemList) {
    super(context, textViewResourceId);
    this.context=context;
    //this.itemList=itemList;

}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    convertView = inflater.inflate(R.layout.spinner_custom, null);
    TextView v = (TextView) super.getView(position, convertView, parent);
    Typeface myTypeFace = Typeface.createFromAsset(context.getAssets(),"fonts/gilsanslight.otf");
    v.setTypeface(myTypeFace);
    v.setText("shooobaloo");
    return convertView;
}


public View getCustomView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
    return super.getView(position, convertView, parent);
}

}

0 个答案:

没有答案