Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android中更改按钮的位置?_Android_Xml_Button - Fatal编程技术网

如何在android中更改按钮的位置?

如何在android中更改按钮的位置?,android,xml,button,Android,Xml,Button,位置取决于其父容器/组件(布局)的位置及其布局属性。 你没有告诉我你想要什么。如果你想改变它的位置-在布局中用另一个视图切换它。在布局中放置更多按钮,并根据你的需要隐藏或显示它们。在线性布局中,你不能大量改变位置-因为布局是线性的(连续的)。但是您可以使用layout_margin来移动小部件 我不知道你想做什么,但你应该看看FrameLayout(它可以让你把图像放在任何地方!)。我个人最喜欢的是RelativeLayout。android中的视图不仅在RelativeLayout中存在关系,

位置取决于其父容器/组件(布局)的位置及其布局属性。
你没有告诉我你想要什么。如果你想改变它的位置-在布局中用另一个视图切换它。

在布局中放置更多按钮,并根据你的需要隐藏或显示它们。

在线性布局中,你不能大量改变位置-因为布局是线性的(连续的)。但是您可以使用layout_margin来移动小部件


我不知道你想做什么,但你应该看看FrameLayout(它可以让你把图像放在任何地方!)。我个人最喜欢的是RelativeLayout。

android中的视图不仅在RelativeLayout中存在关系,而且在其他应用中也存在关系,因此您应该选择描述应用程序布局的最佳方式,使用多个常用方式。
要更改标签的位置,您最好使用AbsoluteLayout,然后再使用android:layout\u x=“”,android:layout\u y=“”

您的确切要求是什么???
您可以放置两个按钮,使一个可见,另一个不可见或相反。或者您可以在所有方向上放置版面空白。并尝试将所有组件放置在不同的版面中。

如果您发布代码、XML或数据示例,请在文本编辑器中突出显示这些行,然后单击“代码示例”按钮(
{}
)在编辑器工具栏上很好地格式化和语法突出显示它!如果您发布错误消息,请使用blockquotes(````)正确设置错误消息的格式。以上是我的代码..现在告诉我如何更改上面代码中的imageButton1。提前谢谢..请告诉我您想做什么。您要求更改位置,但没有告诉我ImageButton的位置。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center" android:background="@drawable/robo">

<TextView android:id="@+id/TextView02"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content" 
android:text="Max Time(Sec)">
</TextView>

<EditText android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:text="100"
 android:id="@+id/maximum" 
android:inputType="number">
</EditText>

<Button android:layout_width="wrap_content" 
android:layout_height="wrap_content"
 android:text="Start" 
android:id="@+id/startbtn" 
android:focusable="true">
</Button>

<ImageButton android:layout_height="wrap_content"
 android:layout_width="wrap_content" 
android:src="@drawable/icon" 
android:id="@+id/imageButton1">
</ImageButton>
</LinearLayout>