Problème d'affichage de deux TextView
Bonjour,
je veux afficher deux textview, mais le problème et qu'une seule ne s'affiche. C'est à dire juste la dernière textview, malgré que lorsque je fait un toast il m'affiche les deux données
Code:
Toast.makeText(this, "title :"+item.getTitle()+" Teaser :"+item.getTeaser() , Toast.LENGTH_SHORT).show();
mais si je change le toast par celle ci il n'affiche que le dernier
voila mon code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| public class detail_article extends Activity {
private static final String title = "title";
private static final String date = "date";
private static final String content = "content";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.single_list_item);
Bundle b = getIntent().getExtras();
// Toast.makeText(this,""+b.getInt(title), Toast.LENGTH_LONG).show();
ItemStructure item=XMLhandler.channelList.get(b.getInt(title));
// Toast.makeText(this, "title :"+item.getTitle()+" Teaser :"+item.getTeaser() , Toast.LENGTH_SHORT).show();
TextView title = (TextView) findViewById(R.id.title);
TextView date = (TextView) findViewById(R.id.date);
TextView content = (TextView) findViewById(R.id.content);
title.setText(item.getTitle());
title.setText(item.getDate());
title.setText(item.getContent());
}
} |
exlplication de code : item retourne la postion dans la listview
Code:
ItemStructure item=XMLhandler.channelList.get(b.getInt(title));
partie XML
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<!-- Name Label -->
<TextView
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textColor="#000000"
android:textStyle="bold"
/>
<TextView
android:id="@+id/date"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:id="@+id/content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.24"
android:textColor="#000000"
android:textStyle="bold"
android:padding="10dp"/>
</LinearLayout> |
Savez vous pourquoi ?
Merci