【问题标题】:how to move the widgets around in an linearlayout如何在线性布局中移动小部件
【发布时间】:2011-07-26 23:39:16
【问题描述】:

我有一个方向为水平的 LinearLayout,并且想在距 TextView 特定距离处放置一个按钮,该怎么做。您能否发布一个教程链接,显示不同布局中不同小部件的定位。谢谢。

【问题讨论】:

    标签: android android-layout android-widget


    【解决方案1】:

    Common Layout Objects | Android Developers 非常有用,尤其是在您正在寻找更多示例的时候。如果您正在寻找纯文档,一切都在这里:User Interface | Android Developers

    对于间距对象,有很多选项,但最直接的方法是设置任一元素的边距:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" android:orientation="horizontal">
        <TextView android:text="TextView" 
            android:id="@+id/editText1" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content"></TextView>
        <Button android:id="@+id/button1" 
            android:layout_marginLeft="50dip" 
            android:text="Button" 
            android:layout_height="wrap_content" 
            android:layout_width="wrap_content"></Button>
    </LinearLayout>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-05
      • 2011-10-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多