Android 如何实现此布局?

Android 如何实现此布局?,android,user-interface,button,menu,android-layout,Android,User Interface,Button,Menu,Android Layout,我试图在android应用程序布局中实现这一点。 到目前为止,我已经成功地按我希望的方式获得了按钮,但是我很难确定如何实现分隔符以及右边的布局 以下是我到目前为止的情况: <?xml version="1.0" encoding="utf-8"?> <!-- this is main activity's layout. a main menu of sorts. --> <LinearLayout xmlns:android="http://schemas.an

我试图在android应用程序布局中实现这一点。

到目前为止,我已经成功地按我希望的方式获得了按钮,但是我很难确定如何实现分隔符以及右边的布局

以下是我到目前为止的情况:

<?xml version="1.0" encoding="utf-8"?>
<!-- this is main activity's layout. a main menu of sorts. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:gravity="center" android:background="@drawable/background">
<RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:id="@+id/layout_maintest2_relativelayoutleft">
    <Button android:text="@string/string_main_NewCalculation" android:drawableLeft="@drawable/calculator5" android:onClick="onClickButton_NewCalculation" android:id="@+id/button_main_NewCalculation" android:layout_width="300px" android:layout_height="90px" android:drawablePadding="0px"></Button>
    <Button android:text="@string/string_main_Help" android:drawableLeft="@drawable/question" android:onClick="onClickButton_Help" android:id="@+id/button_main_Help" android:layout_width="150px" android:layout_height="90px" android:drawablePadding="0px" android:layout_below="@id/button_main_NewCalculation"></Button>
    <Button android:text="@string/string_main_Share" android:drawableLeft="@drawable/share" android:onClick="onClickButton_Share" android:id="@+id/button_main_Share" android:layout_width="150px" android:layout_height="90px" android:drawablePadding="0px" android:layout_below="@id/button_main_NewCalculation" android:layout_toRightOf="@id/button_main_Help"></Button>
</RelativeLayout>
<RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/layout_maintest2_relativelayoutright" android:layout_toRightOf="@id/layout_maintest2_relativelayoutleft" android:layout_alignTop="@id/layout_maintest2_relativelayoutleft">
    <TextView android:layout_width="wrap_content" android:textSize="24px" android:textStyle="bold" android:layout_height="match_parent" android:id="@+id/textView_calculator_CalculatorTitle" android:text="@string/string_calculator_CalculatorTitle"></TextView>
</RelativeLayout>
</LinearLayout>

很难从您上传的图像中分辨出来,但您是否试图将两个相对的布局并排放置

您可以通过将布局声明为绘制到父布局的一侧或另一侧来尝试定位布局。我一时想不起来了,我知道这是个糟糕的答案,但我想答案就在这里的某个地方

看看android:layout\u alignParentRight=“true”声明


我很确定以前我在同一个父视图中使用了类似的方法来定位多个视图和按钮。试试看,星期一我回到工作电脑前,我会仔细检查我的项目,看看哪一个我知道最有效。

你问题的答案取决于文本布局中的内容。如果是一个项目列表,您可以考虑使用ListVIEW。否则,您可能只想在xml文件中或以编程方式创建一组文本视图,并使用RelativeLayout对它们进行排列。它将只是文本字符串、应用程序名称、开发人员名称、简短的说明语句和,a这个应用程序版本的新功能简介B。所以目前我有一个线性布局,包括整个屏幕,然后是其中的两个相对布局。你是说像这样吗?:直线垂直排列。水平直线布置。相对论。密切相关。相对论。密切相关。相对论。密切相关。关闭线性布局。关闭线性布局。我不完全确定我是否完全理解您,但我的建议是,您在每个相对布局中声明它将与父级的左侧或右侧对齐,然后使用填充将其放置到您想要的位置。此外,您可能希望使用dpi而不是pix,因为它会根据每个设备的屏幕密度自动调整自身大小。使用xml进行布局肯定会更快,但要完全控制布局,您可能需要了解如何使用java进行布局现在请记住,我不记得这是将内容绘制到相对布局的右侧,还是将相对布局绘制到其父视图的右侧,但我确实知道这样做会实现您的尝试。是的,我完全理解您。一切听起来都不错,等我有时间再试试。请详细说明dpi与pix的比较。我一直在想设备的兼容性?请记住,这是为蜂窝和以上,一旦所有功能都工作,我将编写一个不同的应用程序的手机屏幕大小。看看这些家伙在我发布的帖子里说了些什么。