2015-07-13 122 views
1
<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:card="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/container" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <!-- Header aligned to top --> 


    <!-- Footer aligned to bottom --> 

    <RelativeLayout 
     android:id="@+id/footer" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:background="#fffff" 
     android:gravity="center" > 

     <TextView 
      android:id="@+id/copyrightext" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="center" 
      android:paddingBottom="5dp" 
      android:paddingTop="5dp" 
      android:singleLine="true" 
      android:textColor="#ffffff" 
      android:textSize="12dp" /> 

     <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="70dp" 
      android:layout_height="14dp" 
      android:layout_centerVertical="true" 
      android:layout_toRightOf="@+id/copyrightext" 
      android:src="@drawable/softagelogo_icon" /> 
    </RelativeLayout> 

    <!-- Content below header and above footer --> 

    <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_above="@id/footer" 
     android:gravity="center" > 

     <com.example.softageinfraapp.PagerSlidingTabStrip 
      android:id="@+id/tabs" 
      android:layout_width="match_parent" 
      android:layout_height="30dp" 
      android:background="@drawable/tabbackground" 
      app:pstsShouldExpand="true" 
      app:pstsTextAllCaps="true" > 
     </com.example.softageinfraapp.PagerSlidingTabStrip> 

     <android.support.v4.view.ViewPager 
      android:id="@+id/viewpager" 
      android:layout_width="match_parent" 
      android:layout_height="fill_parent" 
      android:background="@android:color/black" /> 
    </RelativeLayout> 

</RelativeLayout> 

如何解决错误解析XML:自定义绑定前缀我得到错误com.example.softageinfraapp.PagerSlidingTabStrip我已经对标签定制类创建的,但我得到错误我不知道如何解决它,请帮助我或建议我在哪里做错了。错误解析XML:未绑定的前缀如何解决这个问题

回答

1

您需要定义一个自定义名称空间

<com.example.softageinfraapp.PagerSlidingTabStrip 
xmlns:app="http://schemas.android.com/apk/res/yourpackagename" 
     android:id="@+id/tabs" 
     android:layout_width="match_parent" 
     android:layout_height="30dp" 
     android:background="@drawable/tabbackground" 
     app:pstsShouldExpand="true" 
     app:pstsTextAllCaps="true" > 
这个

更多@http://developer.android.com/training/custom-views/create-view.html

1

您已声明xmlns:card汽车名字空间,但对你的PagerSlidingTabStrip您使用app:的自定义属性。你必须保持一致。您可以用app更换card或使用card:

0

您正在使用您的以下customview“应用程序”的命名空间。

<com.example.softageinfraapp.PagerSlidingTabStrip 
     android:id="@+id/tabs" 
     android:layout_width="match_parent" 
     android:layout_height="30dp" 
     android:background="@drawable/tabbackground" 
     app:pstsShouldExpand="true" 
     app:pstsTextAllCaps="true" > 
</com.example.softageinfraapp.PagerSlidingTabStrip> 

因此,请尝试更改您的父母的主布局,如下所示。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     xmlns:app1="http://schemas.android.com/apk/res/yourpackagename" 
     android:id="@+id/container" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 

而且结帐这样:frequent issues arising in android view, Error parsing XML: unbound prefix

相关问题