CustomView在设计模式下不显示

时间:2018-09-26 06:56:57

标签: android android-layout android-custom-view layout-inflater custom-view

我有一个CustomView的{​​{1}}扩展名。
我在布局文件中使用了RelativeLayout,但在设计模式下使用 Android Studio 却没有显示CustomView。有什么问题吗?

koala_appbar.xml:

CustomView

KoalaAppBar.java:

<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="wrap_content"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_gravity="top"
    tools:context=".activity.basic.BaseActivity">

    <ImageView
        android:id="@+id/appbar_imgLogo"
        android:layout_width="@dimen/appBar_iconWidth"
        android:layout_height="@dimen/appBar_iconHeight"
        android:src="@drawable/logo"
        android:layout_marginTop="@dimen/appBar_iconTopMargin"
        android:layout_marginLeft="@dimen/appBar_iconLeftMargin"
        />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/appbar_height"
        android:orientation="horizontal"
        android:layoutDirection="ltr"
        >

        <koala.android.customer.views.widget.CustomTextView
            android:id="@+id/appBar_txtTitle"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center|right"
            android:text="@string/app_name_persian"
            android:textColor="@color/colorPrimary"
            android:textSize="@dimen/TextSize_large"
            app:tvCustomFont="@string/baseFont"
            />

        <koala.android.customer.views.widget.CustomImageView
            android:id="@+id/appBar_imgBack"
            android:layout_width="@dimen/appbar_height"
            android:layout_height="match_parent"
            app:srcCompat="@drawable/ic_arrow_right"
            app:ivDrawableTint="@color/colorPrimary"
            android:padding="@dimen/appBar_backPadding"
            />

    </LinearLayout>

</RelativeLayout>

0 个答案:

没有答案