添加這是我的主要佈局:無法顯示正確的觀點在運行時
<RelativeLayout style="@style/StandardFillWrap" >
<TableLayout
android:id="@+id/match_tab"
style="@style/StandardFillWrap"
android:stretchColumns="*" >
<TableRow >
<TextView android:id="@+id/match_home_name" />
<TextView android:id="@+id/match_home_score" />
</TableRow>
<TableRow >
<TextView android:id="@+id/match_away_name" />
<TextView android:id="@+id/match_away_score" />
</TableRow>
</TableLayout>
<Button
android:id="@+id/match_filter_b"
style="@style/StandardFillWrap"
android:layout_below="@id/match_tab"
android:text="@string/l_matchView_filters" />
<LinearLayout android:id="@+id/match_list"
style="@style/StandardWrapWrap"
android:layout_below="@id/match_filter_b"
/>
<TableLayout
android:id="@+id/match_reparti"
style="@style/StandardFillWrap"
android:layout_below="@id/match_list"
android:stretchColumns="*" >
<TableRow >
<TextView
android:id="@+id/match_home_name_det"
style="@style/NomePlayer"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView android:text="@string/vuoto" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_indirect_set_pieces" />
<TextView android:text="@string/vuoto" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_defence" />
<TextView android:id="@+id/match_home_set_def" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_attack" />
<TextView android:id="@+id/match_home_set_att" />
</TableRow>
<TableRow >
<TextView android:text="@string/vuoto" />
<TextView android:text="@string/vuoto" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_team_attitude" />
<TextView android:id="@+id/match_home_team_attitude" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_tactic" />
<TextView android:id="@+id/match_home_team_tactic" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_tactic_skill" />
<TextView android:id="@+id/match_home_team_tactic_skill" />
</TableRow>
<TableRow >
<TextView android:text="@string/vuoto" />
<TextView android:text="@string/vuoto" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_midfield" />
<TextView android:id="@+id/match_home_team_midfield" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_right_defence" />
<TextView android:id="@+id/match_home_team_r_def" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_central_defence" />
<TextView android:id="@+id/match_home_team_c_def" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_left_defence" />
<TextView android:id="@+id/match_home_team_l_def" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_right_attack" />
<TextView android:id="@+id/match_home_team_r_att" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_central_attack" />
<TextView android:id="@+id/match_home_team_c_att" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_left_attack" />
<TextView android:id="@+id/match_home_team_l_att" />
</TableRow>
<TableRow >
<TextView
android:id="@+id/match_away_name_det"
style="@style/NomePlayer"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView android:text="@string/vuoto" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_indirect_set_pieces" />
<TextView android:text="@string/vuoto" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_defence" />
<TextView android:id="@+id/match_away_set_def" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_attack" />
<TextView android:id="@+id/match_away_set_att" />
</TableRow>
<TableRow >
<TextView android:text="@string/vuoto" />
<TextView android:text="@string/vuoto" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_team_attitude" />
<TextView android:id="@+id/match_away_team_attitude" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_tactic" />
<TextView android:id="@+id/match_away_team_tactic" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_tactic_skill" />
<TextView android:id="@+id/match_away_team_tactic_skill" />
</TableRow>
<TableRow >
<TextView android:text="@string/vuoto" />
<TextView android:text="@string/vuoto" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_midfield" />
<TextView android:id="@+id/match_away_team_midfield" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_right_defence" />
<TextView android:id="@+id/match_away_team_r_def" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_central_defence" />
<TextView android:id="@+id/match_away_team_c_def" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_left_defence" />
<TextView android:id="@+id/match_away_team_l_def" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_right_attack" />
<TextView android:id="@+id/match_away_team_r_att" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_central_attack" />
<TextView android:id="@+id/match_away_team_c_att" />
</TableRow>
<TableRow >
<TextView android:text="@string/l_matchView_left_attack" />
<TextView android:id="@+id/match_away_team_l_att" />
</TableRow>
</TableLayout>
</RelativeLayout>
和方法,填補了match_list
是:
private void mimicListAdapter(List<Event> eventsList, String filters) {
TextView minute;
ImageView event_key;
TextView event_text;
LayoutInflater inflater = getLayoutInflater();
LinearLayout container = (LinearLayout) findViewById(R.id.match_list);
for(Event p:eventsList) {
//LayoutInflater inflater = getLayoutInflater();
View rowView = inflater.inflate(R.layout.match_event, null, true);
minute = (TextView) rowView.findViewById(R.id.minute);
event_key = (ImageView) rowView.findViewById(R.id.event_img);
event_text = (TextView) rowView.findViewById(R.id.event_text);
boolean found = false;
String[] events = getResources().getStringArray(R.array.filtering);
if(filters!=null)
{
if(filters!="")
{
char[] indici = filters.toCharArray();
for(int i = 0; i<indici.length; i++){
if(events[Character.getNumericValue(indici[i])].contains(","+p.getEventKey()+","))
{
found=true;
break;
}
}
}
}
minute.setText(Integer.toString(p.getMinute()));
event_text.setText(p.getEventText());
try {
Drawable img = getResources().getDrawable(getResources().getIdentifier("i_"+p.getEventKey(), "drawable", getPackageName()));
event_key.setImageDrawable(img);
} catch (Exception e) {
}
if(found) {
event_text.setTextColor(0xFFFF0000);
minute.setTextColor(0xFFFF0000);
found = false;
}
container.addView(rowView);
}
}
問題我得知的是,無論是外部match_list
顯示c或者,在match_list裏面,我可以看到第一個元素,但是它全部是空白的。我的意思是LinearLayout似乎被填滿了,因爲佔據了很多顯示器,但它只是黑色的空間,只有第一個Event
可見。
不...同樣的問題。這很奇怪。 – dierre 2012-03-19 22:38:49