0

i am having a login page done in android using eclipse .
now i want to extend the layout of the login page by setting a fieldset around that window.. (field set as in html.)
can anyone help me please

2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by peter_budo
0

i am having a login page done in android using eclipse .
now i want to extend the layout of the login page by setting a fieldset around that window.. (field set as in html.)
can anyone help me please

this is the format i want to have (the green border)
Please help me..

Edited by sharathg.satya: n/a

Attachments Capture.PNG 28.17 KB
0

Something like this should work

<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
    <stroke android:width="4dp" android:color="#00FF00" /> 
    <solid android:color="#00ff00" /> 
    <padding android:left="7dp" android:top="7dp" 
            android:right="7dp" android:bottom="7dp" /> 
    <corners android:radius="4dp" /> 
</shape>

Edited by peter_budo: n/a

0

Something like this should work

<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
    <stroke android:width="4dp" android:color="#FF00FF00" /> 
    <solid android:color="#00ff00" /> 
    <padding android:left="7dp" android:top="7dp" 
            android:right="7dp" android:bottom="7dp" /> 
    <corners android:radius="4dp" /> 
</shape>
<?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">

	<shape xmlns:android="http://schemas.android.com/apk/res/android">
		
		<stroke android:width="4dp" android:color="#FF00FF00" />
		<solid android:color="#00ff00" />
		<padding android:left="7dp" android:top="7dp" android:right="7dp"
			android:bottom="7dp" />
		<corners android:radius="4dp" />
	<TextView android:layout_width="fill_parent"
		android:layout_height="wrap_content" android:text="@string/hello" />
	<Button android:layout_width="wrap_content"
		android:layout_height="wrap_content" android:text="submit" android:id="@+id/buttonsubmit"></Button>
	</shape>

</LinearLayout>

ERROR:
ClassCastException:com.android.layoutlib.bridge.Mockview cannot be cast to android.view.ViewGroup
Please help...Thanks in advance.

0

Your first mistake, shape is not layout bur drawable resource and I'm sure your IDe indicated so much if you check closely.

Here is simple example
res/drawable/form_border_green.xml

<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">
    <stroke android:color="#00ff00" android:width="2dp"/>
    <padding android:left="15dp" android:top="15dp"
             android:right="15dp" android:bottom="15dp" />
    <corners android:radius="30dp" />
</shape>

res/layout/main.xml

<?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:background="@drawable/form_border_green"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_marginBottom="40dp"
            >
        <EditText
                android:id="@+id/email"
                android:minWidth="250dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:hint="Email address"
                android:inputType="textEmailAddress"
                android:layout_marginBottom="5dp"
                android:layout_centerHorizontal="true"
                />
        <EditText
                android:id="@+id/field_password"
                android:minWidth="250dp"
                android:layout_width="250dp"
                android:layout_height="wrap_content"
                android:layout_below="@id/email"
                android:hint="Password"
                android:inputType="textPassword"
                android:layout_marginBottom="5dp"
                android:layout_centerHorizontal="true"
                />
        <CheckBox
                android:id="@+id/checkbox_save"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Save password"
                android:textColor="#FFFFFF"
                android:layout_below="@id/field_password"
                android:layout_centerHorizontal="true"
                />
        <Button
                android:layout_width="125dp"
                android:layout_height="45dp"
                android:id="@+id/button_login"
                android:text="Login"
                android:layout_below="@id/checkbox_save"
                android:layout_centerHorizontal="true"
                />
    </RelativeLayout>
</RelativeLayout>

FormBorderActivity.java

package com.peter.formborder;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class FormBorderActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}
This question has already been answered. 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.