シークバーのリスナーがシークバーからデータを取得していない理由を知っていますか?私はそれをすべてのセットアップと作業を持っていますが、それはtextviewsを更新イマイチ、私はそれはそれは私がスライダーを使用するたびにAndroid PopupWindowとSeekBarリスナーが応答しない
public class Environment extends Activity implements OnSeekBarChangeListener
{
private ImageButton lockButton;
SeekBar bar;
TextView textProgress, textAction;
private PopupWindow pwindo;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.setup_environment);
lockButton = (ImageButton) findViewById(R.id.lock);
lockButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
initiatePopupWindow();
}
});
}
private void initiatePopupWindow() {
try {
LayoutInflater inflater = (LayoutInflater) Environment.this
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.annotation,
(ViewGroup) findViewById(R.id.popup_element));
pwindo = new PopupWindow(layout, 1000, 1200, true);
pwindo.showAtLocation(layout, Gravity.CENTER, 0, 0);
bar = (SeekBar)findViewById(R.id.seekBar1); // make seekbar object
bar.setOnSeekBarChangeListener(this);
textProgress = (TextView)findViewById(R.id.textViewProgress);
textAction = (TextView)findViewById(R.id.textViewAction);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
// TODO Auto-generated method stub
textProgress.setText("The value is: "+progress);
textAction.setText("changing");
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
textAction.setText("starting to track touch");
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
seekBar.setSecondaryProgress(seekBar.getProgress());
textAction.setText("ended tracking touch");
}
} の内側に座っている活動にさまざまな活動のレイアウトを使用してポップアップウィンドウとは何かを持っていると思いますスライダの位置に応じてint値0〜100で更新する必要があります。これは、アクティビティを作成して直ちに使用すると機能しますが、popupwindowに置くと何もしません。
annotation.xml
<LinearLayout android:id="@+id/popup_element"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#65bea9"
android:orientation="vertical"
android:padding="10sp">
<EditText
android:layout_width="170dp"
android:layout_height="250dp"
android:id="@+id/editText2"
android:layout_gravity="center_horizontal"
android:background="#ffffff"
android:textColor="#000000"
android:hint="@string/hint_annotation"
android:scrollIndicators="right"
android:gravity="top"
android:inputType="textMultiLine"
android:textSize="8pt"/>
<TextView
android:id="@+id/textViewProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="progress displayed here"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_gravity="center"
android:textSize="6pt"></TextView>
<TextView
android:id="@+id/textViewAction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textViewProgress"
android:layout_marginTop="2dp"
android:text="action displayed here"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_gravity="center"
android:textSize="6pt"></TextView>
<SeekBar
android:id="@+id/seekBar1"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView1"
android:layout_marginTop="5dp"
android:max="100"
android:layout_gravity="center"></SeekBar>
<Button
android:id="@+id/btn_close_popup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/btn_submit"/>
セットアップ環境のxml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Activities.Environment">
<ImageButton
android:src="@mipmap/unlocked_syn"
android:layout_width="48dp"
android:layout_height="45dp"
android:id="@+id/lock"
android:layout_row="1"
android:layout_column="11" />
</LinearLayout>
内のビューでfindViewById検索を行うことは、私は完全な活性 – varunkr
の完全なコードを投稿してください、あなたはポップアップウィンドウに自分のシークバーを入れしようとしていますか?アクティビティxmlまたはアノテーションxmlでシークバーを宣言しましたか? –
で更新しているこの活動 – varunkr