Clic sur 2 boutons différents mais même résultat
Bonjour,
J'ai un xml "listes des chapitres" qui contient une liste de chapitre à ouvrir (Chapitre I, chapitre II etc...) j'ai donc un chap1.xml et un chap2.xml
Malheureusement lorsque je texte mon appli, lorsque je clique sur le bouton Chapitre I, j'ai le même résultat que lorsque je clique sur le bouton chapitre II. Alors que mes xml sont bien différents.... Pouvez -vous m'aider svp ?
Mon fichier java :
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
|
public class RulesActivity extends Activity implements OnClickListener{
Button ch1Btn;
Button ch2Btn;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.rules);
//bouton retour
Button backBtn = (Button) findViewById(R.id.backBtn);
backBtn.setOnClickListener(this);
//ouvrir chapitre1
ch1Btn = (Button) findViewById(R.id.ch1Btn);
ch1Btn.setOnClickListener(this);
//ouvrir chapitre2
ch2Btn = (Button) findViewById(R.id.ch2Btn);
ch2Btn.setOnClickListener(this);
}
@Override
public void onClick(View arg0) {
ch1Btn : setContentView(R.layout.chap1);
ch2Btn : setContentView(R.layout.chap2);
}
} |
Mon chap1.xml contient un textView ou se situe mon texte
idem pour mon chap2.xml
une partie de mon chap1.xml : est ce que ça viendrait du textView ???
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
<ScrollView
android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="300px" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF" />
</ScrollView> |