Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/181.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android界面问题_Android_Android Layout - Fatal编程技术网

Android界面问题

Android界面问题,android,android-layout,Android,Android Layout,我正在尝试创建此界面: 下一个文本视图rightTextGenericDialog是带有Send response文本的对话框,sendResponseIB是文本左侧的图像按钮。文本视图和图像按钮应对齐在中间,在中心线下方,在这些按钮下方应为关闭图像按钮 问题是我的界面看起来不应该这样。 我是Android编程新手,所以请温和一点。我不希望这能马上对你起作用。我对重量和布局做了一些更改 <LinearLayout xmlns:android="http://schemas.android.

我正在尝试创建此界面:

下一个文本视图
rightTextGenericDialog
是带有
Send response
文本的对话框,
sendResponseIB
是文本左侧的图像按钮。文本视图和图像按钮应对齐在中间,在中心线下方,在这些按钮下方应为关闭图像按钮

问题是我的界面看起来不应该这样。
我是Android编程新手,所以请温和一点。

我不希望这能马上对你起作用。我对重量和布局做了一些更改

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:id="@+id/displayGenericDialog">

    <LinearLayout
        android:id="@+id/displayMessageTop"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/textMessageTitle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textAlignment="center"
            android:padding="16dp"
            android:textColor="#ffffffff" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/displayMessageCenter"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:orientation="horizontal"
        android:layout_weight="1"
        android:layout_gravity="center">
        <TextView
            android:id="@+id/textMessageText"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:paddingLeft="40sp"
            android:layout_gravity="center"
            android:paddingRight="40sp"
            android:textColor="#ffffffff" />
        <ImageView
            android:id="@+id/messagePicture"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:scaleType="fitXY"
            android:adjustViewBounds="true"
            android:layout_margin="70sp" />
    </LinearLayout>
    <LinearLayout
        android:id="@+id/displayMessageBottom"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal">
        <ImageButton
            android:id="@+id/sendResponseIB"
            android:layout_width="0dp"
            android:layout_height="16dp"
            android:background="@drawable/panel_x"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:onClick="closeProtip" />
        <TextView
            android:id="@+id/leftTextGenericDialog"
            android:layout_width="0dp"
            android:layout_height="16dp"
            android:paddingLeft="10sp"
            android:layout_weight="1"
            android:clickable="true"
            android:textColor="#ff72CCCC"
            android:layout_marginTop="20dp"
            android:layout_gravity="center"/>

    </LinearLayout>

    <ImageButton
        android:id="@+id/rightPictureGenericDialog"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="5sp"
        android:layout_gravity="center"
        android:layout_weight="0.1"
        android:background="@drawable/panel_x"
        android:onClick="closeP" />

</LinearLayout>


试试这个,如果不符合您的要求,请告诉我。

您解决了这个问题吗?下面的答案有用吗?谢谢你的回答!
if(image)
  TextView.setPadding(200, 0, 200, 0);
else
  TextView.setPadding(20, 0, 20, 0);
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:id="@+id/displayGenericDialog">

    <LinearLayout
        android:id="@+id/displayMessageTop"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/textMessageTitle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textAlignment="center"
            android:padding="16dp"
            android:textColor="#ffffffff" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/displayMessageCenter"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:orientation="horizontal"
        android:layout_weight="1"
        android:layout_gravity="center">
        <TextView
            android:id="@+id/textMessageText"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:paddingLeft="40sp"
            android:layout_gravity="center"
            android:paddingRight="40sp"
            android:textColor="#ffffffff" />
        <ImageView
            android:id="@+id/messagePicture"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:scaleType="fitXY"
            android:adjustViewBounds="true"
            android:layout_margin="70sp" />
    </LinearLayout>
    <LinearLayout
        android:id="@+id/displayMessageBottom"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal">
        <ImageButton
            android:id="@+id/sendResponseIB"
            android:layout_width="0dp"
            android:layout_height="16dp"
            android:background="@drawable/panel_x"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:onClick="closeProtip" />
        <TextView
            android:id="@+id/leftTextGenericDialog"
            android:layout_width="0dp"
            android:layout_height="16dp"
            android:paddingLeft="10sp"
            android:layout_weight="1"
            android:clickable="true"
            android:textColor="#ff72CCCC"
            android:layout_marginTop="20dp"
            android:layout_gravity="center"/>

    </LinearLayout>

    <ImageButton
        android:id="@+id/rightPictureGenericDialog"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="5sp"
        android:layout_gravity="center"
        android:layout_weight="0.1"
        android:background="@drawable/panel_x"
        android:onClick="closeP" />

</LinearLayout>