I have selector line on my textView.
selector.xml :
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!--<item android:drawable="@drawable/select_white" android:state_activated="true"/>-->
<item android:drawable="@drawable/select_white" android:state_pressed="true"/>
<item android:drawable="@drawable/select_white" android:state_selected="true"/>
<item android:drawable="@drawable/select_white" android:state_focused="true"/>
<item android:drawable="@drawable/select_none"/>
</selector>
and i set as background for my textView :
<TextView
android:id="@+id/displayPlace"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:clickable="true"
android:text="@string/place"
android:textColor="@color/white"
android:background="@drawable/selector"
android:textSize="@dimen/text_main"/>
when i click on text view selector appeared fine, but i have to do action on my click, so to do my action it's rquired to click twice, I have tried to remove android:focusableInTouchMode="true"
line but it make selector visible for a bit of second and gone.
How i can do action on first click with selector ?
My on Click :
place.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fragment = new PlaceFragment();
replaceFragment(fragment);
Fragment fragment2 = getFragmentManager().findFragmentByTag(TAG_FRAGMENT);
if (fragment2 != null)
getFragmentManager().beginTransaction().remove(fragment2).commit();
}
});