我试图嵌入浮动操作按钮。以下是我的xml文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:background="@drawable/border"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/proformo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="PI 12343"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:orientation="horizontal">
<TextView
android:id="@+id/shippingStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_weight="1"
android:text="Cargo Shipped"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000"
android:textStyle="bold" />
<TextView
android:id="@+id/shippingDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="on07 oct 2015"
android:textColor="#000" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="20dp"
android:orientation="horizontal">
<TextView
android:id="@+id/invoiceNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="PI 12345"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="@+id/invoiceDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="on Dec 2016"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="20dp"
android:orientation="horizontal">
<TextView
android:id="@+id/shipment_ref_no_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Shipment Ref.# :"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="@+id/shipment_ref_no_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="4312412412"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="20dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/etdLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ETD:"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="@+id/etdValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="24 oct 2015"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="@+id/etaLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ETA:"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="@+id/etaValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="09 dec 2014"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="20dp"
android:orientation="horizontal">
<com.android.volley.toolbox.NetworkImageView
android:id="@+id/networkImage"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginRight="10dp"
android:scaleType="centerCrop"
android:src="@drawable/noimage" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/productName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BioMass Pellets"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/quantity_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Quantity: "
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="@+id/quantity_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="40mts"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/amount_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Amount: "
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="@+id/amount_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="200 USD"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/rate_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rate"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="@+id/rate_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="40 USD"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:orientation="horizontal">
<TextView
android:id="@+id/shipped"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Shipped By "
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="@+id/shippedcompany"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:orientation="horizontal">
<android.support.design.widget.FloatingActionButton
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_dialog_email"
app:backgroundTint="@color/colorPrimaryDark"
app:borderWidth="0dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
问题是我收到以下错误消息,
android.view.InflateException:二进制XML文件行#300:错误 inflating类android.support.design.widget.FloatingActionButton 在android.view.LayoutInflater.createView(LayoutInflater.java:626) 在android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702) 在android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 在android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 在android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 在android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 在android.view.LayoutInflater.inflate(LayoutInflater.java:498) 在android.view.LayoutInflater.inflate(LayoutInflater.java:398) 在android.view.LayoutInflater.inflate(LayoutInflater.java:354) 在com.vaighai.adapters.CustomAdapter.getView(CustomAdapter.java:74) 在android.widget.AbsListView.obtainView(AbsListView.java:2627) 在android.widget.ListView.measureHeightOfChildren(ListView.java:1259) 在android.widget.ListView.onMeasure(ListView.java:1171) 在android.view.View.measure(View.java:16831) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245) 在android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410) 在android.widget.LinearLayout.measureVertical(LinearLayout.java:695) 在android.widget.LinearLayout.onMeasure(LinearLayout.java:588) 在android.view.View.measure(View.java:16831) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245) 在android.widget.FrameLayout.onMeasure(FrameLayout.java:310) 在android.view.View.measure(View.java:16831) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245) 在android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410) 在android.widget.LinearLayout.measureVertical(LinearLayout.java:695) 在android.widget.LinearLayout.onMeasure(LinearLayout.java:588) 在android.view.View.measure(View.java:16831) 在android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:940) 在android.view.View.measure(View.java:16831) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245) 在android.widget.FrameLayout.onMeasure(FrameLayout.java:310) 在android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135) 在android.view.View.measure(View.java:16831) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245) 在android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:391) 在android.view.View.measure(View.java:16831) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245) 在android.widget.FrameLayout.onMeasure(FrameLayout.java:310) 在android.view.View.measure(View.java:16831) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245) 在android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410) 在android.widget.LinearLayout.measureVertical(LinearLayout.java:695) 在android.widget.LinearLayout.onMeasure(LinearLayout.java:588) 在android.view.View.measure(View.java:16831) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245) 在android.widget.FrameLayout.onMeasure(FrameLayout.java:310) 在com.android.internal.policy.impl.PhoneWindow $ DecorView.onMeasure(PhoneWindow.java:2586) 在android.view.View.measure(View.java:16831) 在android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2189) 在android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1352) 在android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1535) 在android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1249) 在android.view.ViewRootImpl $ TraversalRunnable.run(ViewRootImpl.java:6364) 在android.view.Choreographer $ CallbackRecord.run(Choreographer.java:791) 在android.view.Choreographer.doCallbacks(Choreographer.java:591) 在android.view.Choreographer.doFrame(Choreographer.java:561) 在android.view.Choreographer $ FrameDisplayEventReceiver.run(Choreographer.java:777) 在android.os.Handler.handleCallback(Handler.java:730) 在android.os.Handler.dispatchMessage(
我该如何解决这个问题?
答案 0 :(得分:2)
问题出在"?android:attr/textAppearanceMedium"
件上。膨胀不能膨胀利用这些元素的元素。