<RelativeLayout
android:id="@+id/btn_alipay"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/btn_line_green"
android:layout_width="match_parent"
android:layout_height="40dp">
<LinearLayout
android:duplicateParentState="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="20dp">
<ImageView
android:duplicateParentState="true"
android:src="@drawable/ic_alipay"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="20dp" />
<TextView
android:duplicateParentState="true"
android:layout_marginLeft="3dp"
android:text="使用支付宝充值"
android:gravity="center"
style="@style/TextView_Small_Green"
android:textColor="@drawable/buyue_green_all"
android:layout_width="wrap_content"
android:layout_height="20dp" />
</LinearLayout>
</RelativeLayout>
android studio 提示
This 'LinearLayout' layout or its 'RelativeLayout' parent is useless; transfer the 'background' attribute to the other view (at line 37)