Reputation: 1634
i'm showing the image of the desired Layout which i want to generate i'm new to android development i'm also listing my XML for this... in which i able to fix TextView and WebView but i'm not able to fix my button on left side can any one suggest me the required addtion which i have to do and where in my XML file.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/txtItem1"
android:text="ITEM"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:textColor="#009966"
android:background="@drawable/txtbackground"
/>
<!-- WebView -->
<LinearLayout android:id="@+id/thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dip"
android:layout_alignParentLeft="true"
android:background="@drawable/image_bg"
android:layout_marginTop="50dip"
>
<WebView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webkit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
/>
</LinearLayout>
</RelativeLayout>
Thanks in Advance.
Upvotes: 0
Views: 629
Reputation: 114
Just Replace below Code It will work.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/header"
>
<TextView
android:id="@+id/txtItem1"
android:text="ITEM"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="50dip"
android:textColor="#009966"
/>
<Button
android:layout_alignParentLeft="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Button"
/>
</RelativeLayout>
<!-- WebView -->
<LinearLayout android:id="@+id/thumbnail"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="3dip"
android:layout_below="@+id/header"
android:layout_marginTop="50dip"
>
<WebView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webkit"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
/>
</LinearLayout>
</RelativeLayout>
Upvotes: 2
Reputation: 3075
Copy and paste this code in your XML file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Button" />
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="39dp"
android:layout_toRightOf="@+id/button1"
android:text="TextView" />
<WebView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webkit"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_below="@+id/button1"
/>
Upvotes: 0
Reputation: 6010
Just Copy and Paste in your file.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<TextView
android:id="@+id/txtItem1"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:background="@drawable/txtbackground"
android:text="ITEM"
android:textColor="#009966" />
</LinearLayout>
<!-- WebView -->
<LinearLayout
android:id="@+id/thumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="50dip"
android:background="@drawable/image_bg"
android:padding="3dip" >
<WebView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webkit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true" />
</LinearLayout>
Upvotes: 1
Reputation: 1882
Without getting too much into the details, your layout should be something like this:
<LinearLayout orientation="horizontal">
<Button />
<TextView />
</LinearLayout>
<WebView />
Upvotes: 0