Question

I need to know how many custom namespaces can we use in one Android XML

here I am using two custom components

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:parallax="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<com.example.abc.components.ParallaxImageView
    android:id="@+id/background"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    parallax:tiltSensitivity="2.5" />

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/transparent_white" >

    <TextView
        android:id="@+id/activity_registration_hi_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:text="@string/activity_registration_hi"
        android:textSize="@dimen/activity_title_text" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/activity_registration_hi_text"
        android:layout_centerHorizontal="true"
        android:layout_marginLeft="@dimen/activity_horizontal_margin"
        android:layout_marginRight="@dimen/activity_horizontal_margin"
        android:text="@string/activity_registration_welcome_text"
        android:textSize="@dimen/activity_large_text" />

    <Button
        android:id="@+id/activity_registration_sign_in_button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:layout_marginLeft="@dimen/activity_horizontal_margin"
        android:layout_marginRight="@dimen/activity_horizontal_margin"
        android:background="@drawable/signin_button_selector"
        android:text="@string/activity_registration_google_plus" />

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/activity_registration_sign_in_button"
        android:layout_centerHorizontal="true"
        android:layout_marginLeft="@dimen/activity_horizontal_margin"
        android:layout_marginRight="@dimen/activity_horizontal_margin"
        android:layout_marginTop="@dimen/activity_vertical_margin_reduced"
        android:background="@drawable/menu_left_devider" />

    <com.example.abc.components.FloatLabelEditText
        android:id="@+id/activity_change_password_old_password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        app:hint="@string/activity_change_password_old_password_hint"
        app:textColor="@color/white"
        app:textColorHintFocused="@color/red"
        app:textColorHintUnFocused="@color/grey"
        app:textHintColor="@color/faded_white"
        app:textSize="@dimen/button_textSize" />
</RelativeLayout>

At FloatLabelEditText component it gives

unbound prefix error

and if I change the namespace from 'parallax' to 'app' than ParallaxImageView gives error.

I searched everywhere tried many things but canot resolve this. Please some one tell me. Can we use more than one Custom Components in one XML ??

I might be wrong but please, need help!

Thanks!!

Was it helpful?

Solution

You're using the namespace app: in the attributes on the com.example.abc.components.FloatLabelEditText element, and the namespace parallax on the com.example.abc.components.ParallaxImageView element, but only one namespace is defined (besides android). You need to add xmlns:app="*" to the RelativeLayout element, or change the app: namespaces to parallax: depending on where the attributes are coming from.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top