I am using PopUpwindow with textviews in it. Problem. When I click on any of the text elements, the background color does not change, although it changes when the text image is focused, but not pressed.
After clicking, I fire popupwindow, and if I don't reject popupwindow, the background color changes according to the selector:
This is my textview background selector:
<item android:state_focused="true" android:drawable="@drawable/focused" />
<item android:state_pressed="true" android:drawable="@drawable/pressed" />
<item android:drawable="@drawable/priornone" /> </selector>
in my popupwindow all i do is:
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);
}});
layout file for 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>
This is a rather strange behavior, everything works well, if I do not reject popupwindow, but if I dismiss popupwindow on a click, the background text does not change.
What am I doing wrong? Any help would be appreciated.
source
share