2011-03-23 38 views
0
<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> 
+0

这里是我们的代码 – Pinki 2011-03-23 07:08:26

+0

如果您发布的代码,XML或数据样本,** **请在高亮文本编辑器的线和编辑器工具栏上单击“代码示例”按钮('{}')很好的格式和语法突出显示它!如果您发布错误消息,**请**使用blockquotes('“')来正确格式化错误消息。 – 2011-03-23 07:11:27

回答

0

在LinearLayout中你不能改变位置一大堆 - 因为布局是线性(顺序)。但是你可以使用layout_margin稍微移动小部件。

我不知道你想做的事,但你应该考虑的FrameLayout(这将让你把图像的任何地方!)。我个人最喜欢的是RelativeLayout。在Android的

0

位置取决于位置的它的父容器/组分(布局)和它的layout_ *特性。 你没有告诉你想要什么。如果你想改变它的位置 - 用布局中的另一个视图切换它。

+0

以上是我的代码..现在让我知道如何在上面的代码中更改我的imageButton1.thanks提前。 。 – Smith 2011-03-23 07:14:20

+0

请告诉什么ü想做的事。ü要求改变位置,但并没有告诉ü想要什么的ImageButton的位置。 – UAS 2011-03-23 11:57:09

0

投入布局更加按键和隐藏或显示他们根据自己的需要

0

的观点是关系,不仅在RelativeLayout的,但其他人,所以你应该选择来描述您的应用程序布局的最佳方式,使用一个以上的常用。 要更改标签的位置,您最好使用AbsoluteLayout,然后使用android:layout_x =“”,android:layout_y =“”

0

您的确切要求是什么? 你可以把两个按钮,使一个可见的和其他无形的一个或副verse.or你可以把layout_margin所有direction.And试图把所有的组件在不同的布局。