我已经创建了搜索栏,我想更新 textview 中的搜索栏值。我做了以下事情。
布局文件的一部分是,
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.15" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="49dp"
android:background="@drawable/circle"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.90" >
<TextView
android:id="@+id/seekvalue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text=" " />
</RelativeLayout>
</LinearLayout>
<SeekBar
android:id="@+id/showvalue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/linearLayout1" />
java代码是,
text=(TextView)findViewById(R.id.seekvalue);
// slide_me.setRightBehindContentView(R.layout.right_menu);
slider=(SeekBar)findViewById(R.id.showvalue);
slider.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
// int progressChanged = 0;
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser){
// progressChanged = progress;
text.setText(progress);
}
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
我有以下运行时错误
09-29 08:08:51.732: E/AndroidRuntime(428): FATAL EXCEPTION: main
09-29 08:08:51.732: E/AndroidRuntime(428): android.content.res.Resources$NotFoundException: String resource ID #0x1
09-29 08:08:51.732: E/AndroidRuntime(428): at android.content.res.Resources.getText(Resources.java:201)
09-29 08:08:51.732: E/AndroidRuntime(428): at android.widget.TextView.setText(TextView.java:2817)
09-29 08:08:51.732: E/AndroidRuntime(428): at com.android.waitress.Calculator$1.onProgressChanged(Calculator.java:39)
09-29 08:08:51.732: E/AndroidRuntime(428): at android.widget.SeekBar.onProgressRefresh(SeekBar.java:89)
09-29 08:08:51.732: E/AndroidRuntime(428): at android.widget.ProgressBar.doRefreshProgress(ProgressBar.java:506)
所以请帮助我...谢谢