2016-12-05 1 views
2

나는 ScrollViewBottomSheetBehavior를 사용해야하지만, 나에게 말 :예기치 않은 네임 스페이스 접두사 "app"가 태그 RelativeLayout에 대해 발견되었습니다. - Android?

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

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

     <android.support.design.widget.AppBarLayout 
      android:id="@+id/ABLList" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:theme="@style/AppTheme.AppBarOverlay"> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       android:background="?attr/colorPrimary" 
       app:popupTheme="@style/AppTheme.PopupOverlay"> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:gravity="end" 
        android:orientation="horizontal"> 

        <ImageButton 
         android:id="@+id/imbDetail" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_gravity="end|center_vertical" 
         android:layout_marginRight="10dp" 
         android:background="@null" 
         android:src="@drawable/ic_action_detail" /> 
       </LinearLayout> 
      </android.support.v7.widget.Toolbar> 

     </android.support.design.widget.AppBarLayout> 

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/recycler_OrderList" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@+id/ABLList" 
      android:scrollbars="vertical" /> 
    </RelativeLayout> 

    <ScrollView 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <RelativeLayout 
      android:id="@+id/layout_bottom_sheet_ListOrder" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_gravity="top" 
      android:background="@color/color_bottom_sheet" 
      android:gravity="top" 
      app:behavior_hideable="true" 
      app:behavior_peekHeight="80dp" 
      app:layout_behavior="@string/string_bottom_sheet_behavior"> 

      <com.example.asheq.utils.TextViewJus 
       android:id="@+id/txtAddress" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="@dimen/text_marginTop" 
       android:gravity="right" 
       android:maxLines="5" 
       android:paddingLeft="@dimen/activity_vertical_margin" 
       android:paddingRight="@dimen/activity_vertical_margin" 
       android:textSize="@dimen/text_size" 
       android:textStyle="bold" /> 

      <Button 
       android:id="@+id/btnSReport" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/txtCTime" 
       android:layout_marginTop="50dp" 
       android:text="@string/btnReport" /> 

     </RelativeLayout> 
    </ScrollView> 

    <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/coordinatorOrder" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" /> 
</android.support.design.widget.CoordinatorLayout> 
+2

textView에 '예기치 않은 네임 스페이스 접두사'app "found"오류가 발생하면'TextView'를'android.support.v7.widget.AppCompatTextView'로 변경해야 할 수도 있습니다. –

답변

1
xmlns:app="http://schemas.android.com/apk/res-auto" 

이 설정되어 여러 번 :

Unexpected namespace prefix "app" found for tag RelativeLayout 

app:behavior_hideable="true" 
app:behavior_peekHeight="80dp" 

여기 내 XML이다. CoordinatorLayout 및 RelativeLayout 둘 다에서. RelativeLayout에서 제거하십시오. 파일에서 한 번만 선언하면 충분합니다.

1

여러 번 사용하려는 경우 상위 레이아웃에서 xmlns 네임 스페이스를 한 번 설정해보십시오.

xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:android="http://schemas.android.com/apk/res/android" 

부모에게이 선언을 한 번만 쓰면됩니다.

힌트 : 다중 레이아웃 및보기를 사용할 때 <include/> 속성을 구현하십시오. 코드를 깨끗하고 쉽게 읽을 수 있습니다.

관련 문제