android - Custom compound control - unbound prefix, failed to instantiate -


i'm trying make compound control, , set custom attributes it.

the class control:

package hu.ppke.itk.kozcs.android.activities;  import hu.ppke.itk.kozcs.android.project.r; import android.content.context; import android.content.res.typedarray; import android.util.attributeset; import android.view.layoutinflater; import android.widget.relativelayout; import android.widget.textview;  public class settingbox extends relativelayout {      public settingbox(context context, attributeset attrs, int defstyle) {         super(context, attrs, defstyle);         string service = context.layout_inflater_service;         layoutinflater li = (layoutinflater) getcontext().getsystemservice(service);         relativelayout layout = (relativelayout) li.inflate(r.layout.setting_box, this, true);         typedarray = context.obtainstyledattributes(attrs, r.styleable.settingbox);         string title = a.getstring(r.styleable.settingbox_title);         string description = a.getstring(r.styleable.settingbox_description);          textview titletext = (textview) layout.findviewbyid(r.id.title);         textview descriptiontext = (textview) layout.findviewbyid(r.id.description);          titletext.settext(title);         descriptiontext.settext(description);          a.recycle();     }   } 

res/values/attrs.xml:

<?xml version="1.0" encoding="utf-8"?> <resources>      <declare-styleable name="settingbox">         <attr name="title" format="string" />         <attr name="description" format="string" />     </declare-styleable>  </resources> 

layout xml control (setting_box.xml):

<?xml version="1.0" encoding="utf-8"?> <merge xmlns:android="http://schemas.android.com/apk/res/android" >      <textview         android:id="@+id/title"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparentleft="true"         android:layout_marginleft="5dp"         android:layout_margintop="5dp"         android:layout_toleftof="@+id/checkbox"         android:text="@string/use_gps"         android:textcolor="@android:color/white"         android:textsize="20sp" />      <textview         android:id="@+id/description"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparentleft="true"         android:layout_below="@+id/title"         android:layout_marginleft="5dp"         android:layout_toleftof="@+id/checkbox"         android:text="@string/gps_descr"         android:textsize="13sp" />      <checkbox         android:id="@+id/checkbox"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparentright="true"         android:layout_centervertical="true"         android:layout_marginright="10dp" />  </merge> 

and layout use control (settings.xml):

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res/hu.ppke.itk.kozcs.android.activities"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical" >      <hu.ppke.itk.kozcs.android.activities.settingbox         andrid:id="@+id/test_setting_box"         android:layout_width="match_parent"         android:layout_height="wrap_content"         app:description="description"         app:title="title" />  </linearlayout> 

every time save last xml, got error message: settings.xml:9: error: error parsing xml: unbound prefix

also there error in log: hu.ppke.itk.kozcs.android.activities.settingbox failed instantiate.

what missing here?

your android:id attribute called andrid:id.

<hu.ppke.itk.kozcs.android.activities.settingbox     andrid:id="@+id/test_setting_box"     android:layout_width="match_parent"     android:layout_height="wrap_content"     app:description="description"     app:title="title" /> 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -