Lead `onClick` from the container to the subsidiary elements
-
Processor appointed
onClick
containerRelativeLayout
♪ There's a container.TextView
who does not respond to the designated processor. Of course the same processor can be assigned andTextView
but I would like to implement everything in xml so that the subsidiary elements inherit from the container. Here's my xml file:<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/relativeFotoAdd" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffaaaaaa" android:clickable="true" tools:context="ru.frozik6k.lohouse.FotosFragment"> <ImageView android:id="@+id/ivFoto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginTop="40dp" android:layout_gravity="center" android:layout_marginBottom="@dimen/view_margin" android:src="@drawable/ic_profile_add_photo_big" /> <TextView android:layout_below="@id/ivFoto" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textMultiLine" android:textColor="@android:color/white"
android:gravity="center" android:textSize="@dimen/text_size" android:text="@string/fragment_fotos_add" />
Is it possible to do something?
Processor:
View.OnClickListener mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mListener != null) {
mListener.onFragmentClickFoto(view, mFotoNumber);
}
}
};
as determined by:
RelativeLayout relativy = (RelativeLayout) view.findViewById(R.id.relativeFotoAdd);
relativy.setOnClickListener(mOnClickListener);
-
Ooh.
TextView
We need to remove the properties.inputType