开发者

how to move the widgets around in an linearlayout

I have a LinearLayo开发者_如何学Gout with orientation as horizontal and would like to place a button at a particular distance from a TextView, how to do it. Can you post a link of tutorial showing positioning of different widgets in various layouts. Thanks.


Common Layout Objects | Android Developers is quite useful, especially if you're looking for something more example-fed. If you're looking for pure documentation, everything is here: User Interface | Android Developers

For spacing objects, there are a lot of options, but the most straightforward is to just set the margin of either element:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" android:orientation="horizontal">
    <TextView android:text="TextView" 
        android:id="@+id/editText1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"></TextView>
    <Button android:id="@+id/button1" 
        android:layout_marginLeft="50dip" 
        android:text="Button" 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content"></Button>
</LinearLayout>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜