视图正在对话框中剪切

时间:2014-07-17 08:46:18

标签: android android-layout android-view android-alertdialog

您好我想在对话框中显示三个按钮,但最后一个按钮的一侧正在剪切图像在下方

enter image description here

      <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
  android:layout_width="@dimen/dialog_width"
  android:layout_height="match_parent"
  android:background="@android:color/white"
   android:orientation="vertical" >

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/textViewEng"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:padding="@dimen/medium"
            android:textColor="@color/blue"
            android:textSize="@dimen/extra_large_text"
            android:textStyle="bold" >
        </TextView>

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_margin="@dimen/medium"
            android:src="@drawable/grey_dots" />

        <com.dictionarylib.widget.GujTextView
            android:id="@+id/textViewGuj"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center"
            android:textColor="@android:color/black"
            android:textSize="@dimen/extra_large_text"
            android:textStyle="bold" />

        <LinearLayout
            android:id="@+id/llListDetailImage"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/small"
            android:background="@drawable/light_blue_rounded"
            android:gravity="center_horizontal" >

            <ImageView
                android:id="@+id/ivListDetail1"
                android:layout_width="@dimen/dialog_image_width"
                android:layout_height="@dimen/dialog_image_width"
                android:layout_marginBottom="@dimen/small"
                android:layout_marginLeft="@dimen/small"
                android:layout_marginTop="@dimen/small"
                android:background="@drawable/white_rounded"
                android:src="@drawable/ic_launcher" />

            <ImageView
                android:id="@+id/ivListDetail2"
                android:layout_width="@dimen/dialog_image_width"
                android:layout_height="@dimen/dialog_image_width"
                android:layout_marginBottom="@dimen/small"
                android:layout_marginLeft="@dimen/small"
                android:layout_marginTop="@dimen/small"
                android:background="@drawable/white_rounded"
                android:src="@drawable/ic_launcher" />

            <ImageView
                android:id="@+id/ivListDetail3"
                android:layout_width="@dimen/dialog_image_width"
                android:layout_height="@dimen/dialog_image_width"
                android:layout_marginBottom="@dimen/small"
                android:layout_marginLeft="@dimen/small"
                android:layout_marginTop="@dimen/small"
                android:background="@drawable/white_rounded"
                android:src="@drawable/ic_launcher" />

            <ImageView
                android:id="@+id/ivListDetail4"
                android:layout_width="@dimen/dialog_image_width"
                android:layout_height="@dimen/dialog_image_width"
                android:layout_marginBottom="@dimen/small"
                android:layout_marginLeft="@dimen/small"
                android:layout_marginRight="@dimen/small"
                android:layout_marginTop="@dimen/small"
                android:background="@drawable/white_rounded"
                android:src="@drawable/ic_launcher" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/medium"
            android:gravity="center_horizontal"
            android:orientation="horizontal"
            android:padding="@dimen/extra_small" >

            <Button
                android:id="@+id/btnListDetailFavorite"
                style="@style/white_medium"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:background="@drawable/yellow_rounded"
                android:drawableLeft="@drawable/dialog_favorite"
                android:minHeight="0dp"
                android:minWidth="0dp"
                android:paddingBottom="@dimen/extra_small"
                android:paddingTop="@dimen/extra_small"
                android:text="@string/favorite" />

            <Button
                android:id="@+id/btnListDetailSound"
                style="@style/white_medium"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/extra_small"
                android:layout_marginRight="@dimen/extra_small"
                android:layout_weight="1"
                android:background="@drawable/apple_green_rounded"
                android:drawableLeft="@drawable/dialog_sound"
                android:minHeight="0dp"
                android:minWidth="0dp"
                android:paddingBottom="@dimen/extra_small"
                android:paddingTop="@dimen/extra_small"
                android:text="@string/sound" />

            <Button
                android:id="@+id/btnListDetailShare"
                style="@style/white_medium"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:background="@drawable/ribbon_blue_rounded"
                android:drawableLeft="@drawable/dialog_share"
                android:minHeight="0dp"
                android:minWidth="0dp"
                android:paddingBottom="@dimen/extra_small"
                android:paddingTop="@dimen/extra_small"
                android:text="@string/share" />
        </LinearLayout>
    </LinearLayout>
</ScrollView>

有没有人知道如何防止按钮被剪切,我已经把完整的xml文件,因为解算器可以理解整个事情

1 个答案:

答案 0 :(得分:0)

尝试为按钮提供保证金,我在这里给出样本,您可以在布局中增加或减少值,

 <Button
                android:id="@+id/btnListDetailShare"
                style="@style/white_medium"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="4dp"
                android:background="@drawable/ribbon_blue_rounded"
                android:drawableLeft="@drawable/dialog_share"
                android:minHeight="0dp"
                android:minWidth="0dp"
                android:paddingBottom="@dimen/extra_small"
                android:paddingTop="@dimen/extra_small"
                android:text="@string/share" />

并给予

android:layout_marginLeft和           其他两个按钮的值android:layout_marginRightandroid:layout_weight="1"也会产生问题,因此请删除或少于 1 适合您的屏幕