【发布时间】:2013-12-05 10:32:18
【问题描述】:
我已经创建了这个布局,但我不知道为什么Button 的高度没有填满布局高度
<?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="wrap_content"
android:orientation="vertical"
>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/pf_sm_dividor_light"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_toLeftOf="@+id/button">
<ImageView
android:id="@+id/li_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_centerVertical="true"
android:src="@drawable/pf_ic_main"
android:layout_alignParentLeft="true"
android:scaleType="centerInside"
android:layout_marginLeft="9dp"
android:contentDescription="@string/pf_app_name" />
<TextView
style="@style/pf.TextView.sm_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center_vertical|left"
android:layout_marginLeft="2dp"
android:text="Text Here"
android:layout_toRightOf="@id/li_icon"
android:layout_alignRight="@+id/pf_sm_ktext" />
<ir.system.views.KText
style="@style/pf.TextView.sm_title"
android:layout_width="wrap_content"
android:textStyle="normal"
android:layout_height="wrap_content"
android:gravity="center_vertical|right"
android:text="1,500"
android:textSize="22sp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:id="@+id/pf_sm_ktext" />
</RelativeLayout>
<!-- Here is the Button -->
<Button
android:layout_alignParentRight="true"
android:layout_width="60dp"
android:layout_margin="0dp"
android:text="+"
android:layout_height="match_parent"
android:background="@drawable/pf_btn"
android:id="@+id/button"
/>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/pf_sm_dividor_dark"
/>
</LinearLayout>
但结果是这样的:
模拟器安卓4.0结果:
【问题讨论】:
标签: android android-layout android-button