簡體   English   中英

如何在線性布局中移動小部件

[英]how to move the widgets around in an linearlayout

我有一個 LinearLayout 方向為水平,並想在距 TextView 特定距離處放置一個按鈕,如何操作。 您能否發布一個教程鏈接,顯示不同小部件在各種布局中的定位。 謝謝。

常見布局對象 | 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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM