Java 如何设置段落之间的标题和间距?
我想将现有视图重写为如下所示: 这是我当前的xml和屏幕截图: 我正在使用这个9补丁:Java 如何设置段落之间的标题和间距?,java,android,xml,android-layout,user-interface,Java,Android,Xml,Android Layout,User Interface,我想将现有视图重写为如下所示: 这是我当前的xml和屏幕截图: 我正在使用这个9补丁: <!-- ======================================================================== * Information layout - contains the explanation text on the background =======================================
<!--
========================================================================
* Information layout - contains the explanation text on the background
========================================================================
-->
<RelativeLayout
android:id="@+id/layout_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/widget_bg_info1"
android:orientation="vertical" >
<TextView
android:id="@+id/text_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="@string/widget_nodata_title"
android:textColor="@color/solid_white"
android:textSize="22sp"
android:layout_above="@+id/widget_error"
android:paddingBottom="20dp"/>
<ImageView
android:id="@+id/widget_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:src="@drawable/widget_error"
android:layout_centerHorizontal="true" />
<LinearLayout
android:id="@+id/layout_text_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/text_info1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="87dp"
android:gravity="left"
android:paddingLeft="18dp"
android:paddingRight="15dp"
android:text="@string/widget_nodata_info1"
android:textColor="@color/solid_black"
android:textSize="15sp" />
<TextView
android:id="@+id/text_info2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="10dp"
android:gravity="left"
android:paddingLeft="18dp"
android:paddingRight="15dp"
android:text="@string/widget_nodata_info2"
android:textColor="@color/solid_black"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="@+id/text_info3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="10dp"
android:gravity="left"
android:paddingLeft="18dp"
android:paddingRight="15dp"
android:text="@string/widget_nodata_info3"
android:textColor="@color/solid_black"
android:textSize="15sp" />
</LinearLayout>
<!--
========================================================================
* Buttons layout - contains all the texts
========================================================================
-->
<LinearLayout
android:id="@+id/layout_buttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal"
android:layout_below="@+id/layout_text_info"
android:layout_centerHorizontal="true"
android:gravity="center"
android:paddingTop="20dp">
<LinearLayout
android:layout_width="130dp"
android:layout_height="wrap_content"
android:background="@drawable/button_blue"
android:clickable="true"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
<TextView
android:id="@+id/text_btn_enter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/widget_no_data_accept"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:background="@drawable/button_blue"
android:clickable="true"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
<TextView
android:id="@+id/text_btn_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/widget_no_data_close"
android:textColor="#000000" />
</LinearLayout>
</LinearLayout>
</RelativeLayout> <!-- -->
如何将标题置于灰色顶部区域的顶部
如何将底部的两个按钮居中?这会将按钮布局固定到底部,并根据需要将它们居中。如果你能更清楚,我可以帮助你的房子形象和标题以及。(关于id名称)
如果这是房屋图片的imageview,那么它也是固定的。只要给你想要的最高利润
<ImageView
android:id="@+id/widget_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@+id/text_title"
android:gravity="center"
android:src="@drawable/widget_error" />
这会将按钮布局固定在底部,并根据需要将其居中放置。如果你能更清楚,我可以帮助你的房子形象和标题以及。(关于id名称)
如果这是房屋图片的imageview,那么它也是固定的。只要给你想要的最高利润
<ImageView
android:id="@+id/widget_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@+id/text_title"
android:gravity="center"
android:src="@drawable/widget_error" />
我猜他们在使用alignParentTop
,alignParentLeft
和第二段(空白)中的alignParentBottom
。该按钮刚刚对齐。它不起作用。您可以查看我的xml吗?我猜他们正在使用alignParentTop
,alignParentLeft
和第二段(空白)的段落-alignParentBottom
。该按钮刚刚对齐。它不起作用。你能看看我的xml吗?重力不适合我。我已经编辑了我的xml。你能看一下吗?用一个大的线性布局而不是相对的布局会更好吗?你确实复制粘贴了这个并检查了吗?因为它对我有用吗?我是在自己测试后写的。它不仅使重力居中,而且使填充父对象成为外部线性布局。请尝试imageview,因为它也可以工作。是的,使用线性布局会更好,因为您没有复杂的界面,但这取决于您的编码风格。对于底部按钮不起作用。我的标题也不见了(隐藏在灰色区域后面)@EladBenda您使用的是哪个模拟器/设备,您运行的是哪个版本(AOSP还是?)的Android,以及您构建应用程序的SDK?你的目标是什么API级别?重力对我不起作用。我已经编辑了我的xml。你能看一下吗?用一个大的线性布局而不是相对的布局会更好吗?你确实复制粘贴了这个并检查了吗?因为它对我有用吗?我是在自己测试后写的。它不仅使重力居中,而且使填充父对象成为外部线性布局。请尝试imageview,因为它也可以工作。是的,使用线性布局会更好,因为您没有复杂的界面,但这取决于您的编码风格。对于底部按钮不起作用。我的标题也不见了(隐藏在灰色区域后面)@EladBenda您使用的是哪个模拟器/设备,您运行的是哪个版本(AOSP还是?)的Android,以及您构建应用程序的SDK?您的目标API级别是什么?