[英]need help in android layouts
hi i want to create aa layout which must have an EditText and a Sibmit Button in a top of the screen and They should horizontally aligned and filled the whole horizontal space. 您好我想创建一个必须在屏幕顶部具有EditText和Sibmit Button的布局,并且它们应该水平对齐并填充整个水平空间。
whenever i go to portrait or landscape mode it should fill the whole horizontal space. 每当我进入纵向或横向模式时,它都应该占据整个水平空间。 Please guide.
请指导。 m stucked at this point in my application
我的应用程序此时卡住了
Thanks 谢谢
you can try this : 你可以试试这个:
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button android:id="@+id/btnSubmit" android:layout_width="wrap_content"
android:text="Submit"
android:layout_height="wrap_content" android:layout_alignParentTop="true"
android:layout_alignParentRight = "true" android:padding = "4dp" />
<EditText android:id="@+id/txtEdit" android:layout_width="fill_parent"
android:layout_toLeftOf="@id/btnSubmit"
android:layout_height="wrap_content" android:layout_alignTop="@id/btnSubmit"
android:layout_alignBottom = "@id/btnSubmit" android:padding = "4dp" />
</RelativeLayout>
hope it helps :) 希望能帮助到你 :)
Note :take a look on this link , it's very helpful for you ;) Understanding User Interface in Android 注意:请查看此链接,它对您非常有帮助;) 了解Android中的用户界面
im done with that adding a weight= 1 did my work. 我完成了权重= 1的工作。
<LinearLayout android:id="@+id/rl1" android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_below="@+id/message" >
<EditText android:id="@+id/search_bar" android:singleLine="true" android:hint="Search"
android:layout_width="fill_parent" android:layout_weight="1" android:layout_height="wrap_content"></EditText>
<Button android:id="@+id/search_submit" android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_alignParentRight="true" android:text="Search"></Button>
</LinearLayout>
this works great.. Please vote this answer so that others can also take help. 这很好。.请对这个答案进行投票,以便其他人也可以寻求帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.