1
我想用LayouInflater以編程方式創建我的RelativeLayout但將在AddView方法的錯誤,繼承人是我的代碼:LayoutInflater單爲Android
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeAgedSummary"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>
ViewGroup relativeAgedSummary=FindViewById<ViewGroup>(Resource.Id.relativeAgedSummary);
View view = this.LayoutInflater.Inflate(
Resource.Layout.aged_summary_list_item,
relativeAgedSummary, false);
for (int i = 0; i < agedValues.Count; i++) {
var row = agedValues.ElementAt(i);
if(row.Range == 0 && row.IsTotal == false)
{
RelativeLayout rl = view.FindViewById<RelativeLayout>(
Resource.Id.relativeLayoutAgedSummaryItem);
rl.SetBackgroundResource(Resource.Color.lightBlue);
if(contA==0)
{
TextView tv = (TextView)view.FindViewById(Resource.Id.txtAgedSummary);
tv.SetText(labelsAgedSummary[row.Range], TextView.BufferType.Normal);
contA++;
}
relativeAgedSummary.AddView(view);
}
它拋出的錯誤是什麼? http://docs.xamarin.com/android/advanced_topics/android_debug_log – 2012-02-27 19:47:58
一個固定的,但現在我想添加更多的實際佈局,它只出現一個 – arkmetal 2012-02-27 20:00:09