开发者

How to add another button or a textview right next to another button?

开发者 https://www.devze.com 2023-02-13 12:25 出处:网络
How can i add another button or textview right next the another button? I\'m new in Android programming and XML as well

How can i add another button or textview right next the another button? I'm new in Android programming and XML as well Here is my xml code:

  <?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="vertical"

    android:background="@drawable/background_start"
     >

 <Button 

         android:id="@+id/prvo"
         android:text="Прво копче" 
         android:textStyle="bold"
         android:layout_marginTop="25px"
         android:layout_margin="15px"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:visibility="visible"

         android:onClick="hello"
         />
 &l开发者_如何学编程t;EditText android:maxLines="1" 
 android:scrollbars="vertical" 
 android:text="Пиши нешто овде" 
 android:layout_width="match_parent" 

 android:id="@+id/editText1" 
 android:layout_height="wrap_content">
 </EditText>
</LinearLayout>

Should i change the layout template? Switchit to relative or table layout instead of linear?


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
<Button
    android:text="Blah" 
    android:id="@+id/addemail" 
    android:layout_height="wrap_content"
    android:layout_width="wrap_content">
</Button>
<Button
    android:text="Blergh" 
    android:id="@+id/sendmail" 
    android:layout_height="wrap_content"
    android:layout_width="wrap_content" >
 </Button>
</LinearLayout>
</LinearLayout>

Also have a look at this answer its pretty good.

0

精彩评论

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