Hello I made this compound view that contains a text view (to display error or advice) and a edit text (for input)
<TextView android:id="@+id/guidanceOrError" android:gravity="center" android:padding="10dp" android:text="Please input 6 characters and 1 number" android:layout_marginBottom="10dp" android:background="@drawable/input_guidance_background" android:layout_width="match_parent" android:layout_height="wrap_content" /> <EditText android:id="@+id/inputField" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/rectangle_border" android:padding="@dimen/login_editText_padding" tools:hint="@string/user_name"/> </merge> And this is me using it in an activity layout
<com.ersen.test.widgets.ValidationInputField android:id="@+id/password" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/login_editText_top_margin" android:hint="@string/password" android:inputType="textPassword" /> My problem is that attributes like hint and inputType are being ignored. This is because in my init(AttributeSet attrs) method I am not getting the attributes out
if(attrs != null){ TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.???); a.recycle(); } My question is how can I use attributes that already exist? I do not want to re-create them
Please help me and thanks for reading
Edit 1 My compound view extends LinearLayout