PopUpwindowにtextviewsを使用しています。問題は、テキストビューのいずれかをクリックすると、テキストビューがフォーカスされているがクリックされていないときに変化していても、背景色は変化していない。popupwindowのクリックでtextviewの背景色が変わらない
<item android:state_focused="true" android:drawable="@drawable/focused" />
<item android:state_pressed="true" android:drawable="@drawable/pressed" />
<item android:drawable="@drawable/priornone" /> <!-- default --> </selector>
に:これは私のTextViewの背景セレクタは
です:私はpopupwindowを却下し、私はその後、popupwindowを却下していない場合は、背景色の変更セレクタに従っていますクリックした後
私popupwindow私がやっているすべての本である:
TextView manage_list = (TextView)popupView.findViewById(R.id.manage_lists);
manage_list.setOnClickListener(new View.OnClickListener(){
public void onClick(View v)
{
Intent myIntent = new Intent(v.getContext(),ManageList.class);
popupWindow.dismiss();
startActivity(myIntent);
}});
popupwindowためのレイアウトファイル:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/pop_menu_bg"
android:orientation="vertical"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/manage_lists"
android:text="Manage lists"
android:background="@drawable/my_drawable"
>
</TextView>
</LinearLayout>
私がpopupwindowを却下しなければ、非常に奇妙な振る舞いがうまくいくが、クリックするとpopupwindowを閉じると、textviewの背景は変わらない。
私は何をしていますか?どんな助けもありがとう。
提案をいただきありがとうございましたが、それでも助けにはなりませんでしたが、まだテキストビューの背景はクリックで変更されていません。 – kay
@kayレイアウトXMLファイルを投稿できますか?私は、このコードとあなたの質問に答えた他のコードは正しいと考えていますので、問題はどこか別のものかもしれません。 – Angelo
私はレイアウトファイルを投稿しました。 – kay