0

Hi
i try show layout like image 1 (textView and editText in same line) but my out put shown like image 2 ! i try with this code :

<?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="wrap_content"
	android:padding="5px"
	>

	<TextView 
	    android:id="@+id/label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="URL:"
        android:layout_alignBaseline="@+id/entry"
        android:layout_alignParentLeft="true"/>
        />
		
	<EditText 
	    android:id="@+id/entry"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/label"
        android:layout_alignParentTop="true"
		/>

	<Button 
	    android:id="@+id/button" 
	    android:layout_width="wrap_content"
		android:layout_height="wrap_content" 
		android:layout_gravity="center_horizontal"
		android:paddingRight="30px" 
		android:paddingLeft="30px" 
		android:text="Go..." 
		/>

</LinearLayout>

what should i do ?
thanks

Attachments 1.jpg 9.35 KB 2.jpg 10.16 KB
2
Contributors
1
Reply
4
Views
7 Years
Discussion Span
Last Post by shibby
0

Hi mahdi68,
You need set the orientation of your linear layout to "horizontal" instead of vertical. i.e :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="horizontal" 
	android:layout_width="fill_parent"
	android:layout_height="wrap_content"
	android:padding="5px"
	>

	<TextView 
	    android:id="@+id/label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="URL:"
        android:layout_alignBaseline="@+id/entry"
        android:layout_alignParentLeft="true"/>
        />
		
	<EditText 
	    android:id="@+id/entry"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/label"
        android:layout_alignParentTop="true"
		/>

	<Button 
	    android:id="@+id/button" 
	    android:layout_width="wrap_content"
		android:layout_height="wrap_content" 
		android:layout_gravity="center_horizontal"
		android:paddingRight="30px" 
		android:paddingLeft="30px" 
		android:text="Go..." 
		/>

</LinearLayout>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.