【发布时间】:2017-06-08 20:38:44
【问题描述】:
我有 DialogFragment 布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/white"
android:orientation="vertical"
android:paddingTop="21dp"
android:paddingLeft="24dp"
android:paddingRight="8dp"
android:paddingBottom="8dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="@string/lbl_why_go_away"
android:textStyle="bold"
android:textColor="@color/whyGoAwayCaption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/fontHuge"
android:layout_marginBottom="5dp"
android:layout_marginRight="18dp"
android:layout_weight="0" />
<ListView
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginRight="18dp"
android:id="@+id/reasonsList" />
<EditText
android:inputType="textMultiLine"
android:layout_width="match_parent"
android:layout_height="108dp"
android:layout_marginTop="18dp"
android:layout_marginRight="18dp"
android:layout_marginBottom="24dp"
android:gravity="top|left"
android:padding="16dp"
android:background="@drawable/cancel_dialog_your_reason_bg"
android:hint="@string/ph_your_reason"
android:layout_weight="0"
android:id="@+id/otherReasonEditText" />
<LinearLayout
android:orientation="horizontal"
android:layout_weight="0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right">
<Button
android:background="#CCCCCC"
android:text="@string/btn_return"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/primaryRed"
android:drawablePadding="0dp"
android:gravity="center_vertical"
android:layout_margin="0dp"
android:paddingLeft="9dp"
android:paddingRight="9dp"
android:paddingTop="9dp"
android:paddingBottom="9dp"
android:id="@+id/returnButton" />
<Button
android:background="#CCCCCC"
android:text="@string/btn_ready"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="9dp"
android:paddingRight="9dp"
android:paddingTop="9dp"
android:paddingBottom="9dp"
android:drawablePadding="0dp"
android:layout_margin="0dp"
android:textColor="@color/primaryRed"
android:gravity="center_vertical"
android:id="@+id/readyButton" />
</LinearLayout>
看起来像这样(Android 4.2 Galaxy S4):
按钮大小问题。他们应该只在文本周围填充 8dp,没有别的,但它们比文本大小大得多。如果我将背景设置为@android:color/transparent 视图是相同的。告诉我,怎么了?
PS:右图(VisualStudio 预览截图)
【问题讨论】:
标签: android xml android-layout xamarin xamarin.android