2015-07-13 126 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

相關問題