开发者

how can i make the View do NOT expand over its sibling View

I have a layout similiar to this:

<Relative开发者_如何学编程Layout ...>
     <EditText android:id="@+id/editbox" 
            android:layout_width="wrap_content" .../>
     <Button android:layout_right="@id/editbox" 
            android:layout_width="wrap_content"
            android:text="Button" />
 </RelativeLayout>

The button is at the right of the edit text. And the edit text is 'wrap_content'. When i type texts into the edit view, the view's width increase and will expand to my button. I want the two views (button and edit text) have their own area. How to configure this?


Hi Keyin Lynx: Use minWidth and maxWidth attribute,For Instance:

android:minWidth="10dip", android:maxWidth="60dip", attributes.


Instead of using android:layout_right="@id/editbox use this android:layout_alignParentRight="true" so that the Button will be always placed at right side of the EditText

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜