здесь довольно простой вопрос, но я еще не являюсь суперпользователем java.
Я использую ViewFlipper для предоставления нескольких изображений и выдвижной ящик для текста, специфичного для каждого изображения.Я хотел бы, чтобы текст выдвижного ящика изменился на конкретную строку в зависимости от того, какой дочерний вид отображается в данный момент.Вот XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Prev" />
<Button
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Next" />
</LinearLayout>
<ViewFlipper
android:id="@+id/flipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/image1"></ImageView>
<ImageView android:id="@+id/imageView2" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/image2"></ImageView>
</ViewFlipper>
</LinearLayout>
Вот Java:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
flipper = (ViewFlipper)findViewById(R.id.flipper);
next = (Button) findViewById(R.id.next);
previous = (Button) findViewById(R.id.previous);
imageview1 = (ImageView)findViewById(R.id.imageView1);
imageview2 = (ImageView)findViewById(R.id.imageView2);
next.setOnClickListener(this);
previous.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if (v == next) {
flipper.setInAnimation(inFromRightAnimation());
flipper.setOutAnimation(outToLeftAnimation());
flipper.showNext();
}
if (v == previous) {
flipper.setInAnimation(inFromLeftAnimation());
flipper.setOutAnimation(outToRightAnimation());
flipper.showPrevious();
}
}
Я уверен, что ответ действительно очевиден, но именно поэтому мне нужна ваша помощь .... СПАСИБО!