在我的飛旋我試圖連接的圖像和文本查看,資源ID文本視圖錯誤而安裝圖像
以下是我的佈局XML
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/UICurrencyCurrencyFlag"
android:layout_height="20dp"
android:layout_width="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/cross_btn" />
<TextView
android:id="@+id/UICurrencyCurrencyName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:textStyle="bold"
android:layout_toRightOf="@+id/UICurrencyCurrencyFlag"
android:text="TextView" />
</RelativeLayout>
以下是我使用的構造我的自定義數組適配器
public class CustomArrayAdapterForCurrencies extends ArrayAdapter<CharSequence>
{
private final Activity context;
public final CharSequence[] keys;
public CustomArrayAdapterForCurrencies(Activity context, CharSequence[] keys)
{
super(context, R.layout.ui_currency_layout,keys);
this.context = context;
this.keys = keys;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = null;
LayoutInflater inflator = context.getLayoutInflater();
view = inflator.inflate(R.layout.ui_currency_layout, null);
final ViewHolder viewHolder = new ViewHolder();
當我的活動開始,微調確實顯示圖像和文字,但是當我試圖選擇微調器它給出錯誤Adapter need resouce id for the text view
我怎樣才能解決這個問題, 問候
ch eck out,我已經做了同樣的事情。 – 2012-03-22 06:37:23