I am using scroll view inside RelativeLayout and I am assigning onClickLIstener to RelativeLayout.
I am using following code. Layoutfile
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/row2_lnr_layout_ver">
<ScrollView
android:id="@+id/row2_scrollview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fadeScrollbars="false"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbars="vertical"
android:fillViewport="true">
<TextView
android:id="@+id/sa_sub_txt_view_2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="10dp"
android:layout_weight="0.4"
android:paddingLeft="10dp"
android:text="hjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj"
android:textColor="@android:color/black">
</TextView>
</ScrollView>
</RelativeLayout>
Java File in OnCreate()
((RelativeLayout)findViewById(R.id.row2_lnr_layout_ver)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Log.i("MainActivity", "onSmartActionClicked");
Toast.makeText(getApplicationContext(), "Clicked", Toast.LENGTH_SHORT).show();
}
});
So when I click on TextView or scrollview, it does not show Toast. But when I remove scroll view and click on textview, then it works fine. Can anybody tell me why this strange behavior while using ScrollView??