简体   繁体   English

在Android应用中手动排列布局中的按钮

[英]Manually arrange buttons in layout in Android app

I would like to know how to make a layout like this picture : http://www.noelshack.com/2014-13-1395752335-app.png 我想知道如何制作这样的图片布局: http//www.noelshack.com/2014-13-1395752335-app.png

I have no idea how I can do that. 我不知道我怎么能这样做。 I already have a LinearLayout with some buttons inside, but I don't know how to move them easily. 我已经有一个内部有一些按钮的LinearLayout,但我不知道如何轻松移动它们。

Thanks in advance for your help (and sorry for my bad english !) 在此先感谢您的帮助(抱歉我的英语不好!)

If You are suggesting interactive moving of items, then You should search for "Drag and Drop". 如果您建议交互式移动项目,则应搜索“拖放”。 For example: Drag and drop for linearlayout's child views . 例如: 拖放linearlayout的子视图

If you want to overlay one view over another - then use RelativeLayout and remember that latest view in xml layout has more Z axis value. 如果要将一个视图覆盖在另一个视图上,请使用RelativeLayout并记住xml布局中的最新视图具有更多Z轴值。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<Button
    android:id="@+id/button_below"
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:layout_centerVertical="true"
    android:text="ButtonBelow" />

<Button
    android:id="@+id/button_above"
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:layout_alignBottom="@+id/button_below"
    android:layout_alignParentLeft="true"
    android:layout_marginBottom="62dp"
    android:text="ButtonAbove" />

</RelativeLayout>

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM