fragment_main GUI界面的替代方案,用于布局构建,用于精确调整大小和定位

时间:2014-06-01 20:22:53

标签: android android-layout

我目前正在使用Eclipse进行Android开发。我对这种环境的最大抱怨是布局构建器不是WYSISYG。我可以拖动我的按钮或Textviews,但是一旦我释放按钮,Textview / Button /等的定位和大小就会随处可见。

我感兴趣的是通过我的fragment_main.xml对我的对象的定位/大小进行手动操作。

以下是我的布局示例。我目前正在使用RelativeLayout

<TextView
    android:id="@+id/display_city"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/display_today_date"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/get_data"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="42dp"
    android:layout_marginTop="51dp"
    android:gravity="center_horizontal"
    android:shadowColor="@color/text_shadow"
    android:shadowDx="1"
    android:shadowDy="1"
    android:shadowRadius="3"
    android:textColor="@color/light_font"
    android:textSize="25sp" />

<Button
    android:id="@+id/get_data"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignRight="@+id/display_city"
    android:layout_marginTop="16dp"
    android:shadowColor="@color/text_shadow"
    android:shadowDx="1"
    android:shadowDy="1"
    android:shadowRadius="3"
    android:textColorHint="@color/light_font"
    android:textColor="@color/light_font"
    android:text="@string/get_pollen_index" />

这是它的样子:

enter image description here

如何精确定义物体的大小和位置?

0 个答案:

没有答案