这是我的线性布局
<?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:background="@android:color/white"
android:gravity="center_horizontal"
android:orientation="vertical" >
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".16"
android:ems="10"
android:text="Rule" >
<requestFocus />
</AutoCompleteTextView>
<LinearLayout style="@style/verticallayout" >
<LinearLayout style="@style/verticallayout" >
<Button
android:id="@+id/b1"
style="@style/buttons"
android:layout_weight=".16"
android:text="Button 1" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll41"
style="@style/horizontallayouthidden" >
<TextView
android:id="@+id/t1"
style="@style/textview"
android:layout_weight="0.5" />
<TextView
android:id="@+id/tt1"
style="@style/textview"
android:layout_weight="0.5" />
</LinearLayout>
</LinearLayout>
<LinearLayout style="@style/verticallayout" >
<LinearLayout style="@style/verticallayout" >
<Button
android:id="@+id/b2"
style="@style/buttons"
android:layout_weight=".16"
android:text="Button 2" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll42"
style="@style/horizontallayouthidden" >
<TextView
android:id="@+id/t2"
style="@style/textview"
android:layout_weight="0.5" />
<TextView
android:id="@+id/tt2"
style="@style/textview"
android:layout_weight="0.5" />
</LinearLayout>
</LinearLayout>
<LinearLayout style="@style/verticallayout" >
<LinearLayout style="@style/verticallayout" >
<Button
android:id="@+id/b3"
style="@style/buttons"
android:layout_weight=".16"
android:text="Button 3" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll43"
style="@style/horizontallayouthidden" >
<TextView
android:id="@+id/t3"
style="@style/textview"
android:layout_weight="0.5" />
<TextView
android:id="@+id/tt3"
style="@style/textview"
android:layout_weight="0.5" />
</LinearLayout>
</LinearLayout>
<LinearLayout style="@style/verticallayout" >
<LinearLayout style="@style/verticallayout" >
<Button
android:id="@+id/b4"
style="@style/buttons"
android:layout_weight=".16"
android:text="Button 4" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll44"
style="@style/horizontallayouthidden" >
<TextView
android:id="@+id/t4"
style="@style/textview"
android:layout_weight="0.5" />
<TextView
android:id="@+id/tt4"
style="@style/textview"
android:layout_weight="0.5" />
</LinearLayout>
</LinearLayout>
<LinearLayout style="@style/verticallayout" >
<LinearLayout style="@style/verticallayout" >
<Button
android:id="@+id/b5"
style="@style/buttons"
android:layout_weight=".16"
android:text="Button 5" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll45"
style="@style/horizontallayouthidden" >
<TextView
android:id="@+id/t5"
style="@style/textview"
android:layout_weight="0.5" />
<TextView
android:id="@+id/tt5"
style="@style/textview"
android:layout_weight="0.5" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/left"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.5"
android:enabled="false"
android:text="Prev" />
<Button
android:id="@+id/right"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.5"
android:text="Next" />
</LinearLayout>
这是我的java类
public void onClick(View arg0) {
String a=null;
switch(arg0.getId()){
case R.id.left:
Toast.makeText(getApplicationContext(), "Prev"+ count, Toast.LENGTH_LONG).show();
if( count==0)
prev.setEnabled(false);
else{
count--;
Toast.makeText(getApplicationContext(), "Prev", Toast.LENGTH_LONG).show();
}
break;
case R.id.right:
Toast.makeText(getApplicationContext(), "Prev"+ count, Toast.LENGTH_LONG).show();
if( count>((abc.size()/5)))
next.setEnabled(false);
else{
count++;
onClick(arg0);
}
break;
case R.id.b1:
t41.setText("t1");
tt41.setText("tt1");
a=abc.get(( count*0)+0)+"";
bb1.setText(a);
}
break;
case R.id.b2:
t42.setText("t1");
tt42.setText("tt1");
a=abc.get(( count*0)+1)+"";
bb2.setText(a);
}
break;
case R.id.b3:
t43.setText("t1");
tt43.setText("tt1");
a=abc.get(( count*0)+2)+"";
bb3.setText(a);
}
break;
case R.id.b4:
t44.setText("t1");
tt44.setText("tt1");
a=abc.get((count*0)+3)+"";
bb4.setText(a);
}
break;
case R.id.b5:
t45.setText("t1");
tt45.setText("tt1");
a=abc.get((count*0)+4)+"";
bb5.setText(a);
}
break;
}
}
现在,当我从列表“abc”中可用的列表中单击下一个和上一个按钮动态时,我想更改按钮的文本。计数是另一个类中的 STATIC 变量。当我单击按钮中的值没有变化时。谁能帮我解决这个问题..