在android中设置布局的正确位置在哪里?

时间:2014-06-09 17:42:43

标签: android

我在res中有2个文件。 Activity_main.xml是

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.test2.MainActivity"
    tools:ignore="MergeRootFrame" />

fragment_main.xml是

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.test2.MainActivity$PlaceholderFragment" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

</RelativeLayout>

我计划在当前布局中更改我遇到问题的布局时,我拖放所有项目只是重叠在一起如何制作漂亮的表单类型布局?我必须调整哪些调整和哪个文件?

1 个答案:

答案 0 :(得分:1)

听起来您正在使用Eclipse GUI工具来创建布局。我强烈建议您阅读Android Layouts。如果需要,您可以直接编辑XML布局文本,或者至少可以帮助您了解可以为控件设置的属性,以获得您想要的精确外观。