0% found this document useful (0 votes)
16 views4 pages

Toggle Button

Uploaded by

prajwalcharthad6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

Toggle Button

Uploaded by

prajwalcharthad6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Toggle button

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:app="http://schemas.android.com/apk/res-auto"

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

tools:context="example.javatpoint.com.togglebutton.MainActivity">

<ToggleButton

android:id="@+id/toggleButton"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginLeft="8dp"

android:layout_marginTop="80dp"

android:text="ToggleButton"

android:textOff="Off"

android:textOn="On"

app:layout_constraintEnd_toStartOf="@+id/toggleButton2"

app:layout_constraintStart_toStartOf="parent"

app:layout_constraintTop_toTopOf="parent" />

<ToggleButton

android:id="@+id/toggleButton2"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginRight="60dp"

android:layout_marginTop="80dp"

android:text="ToggleButton"

android:textOff="Off"

android:textOn="On"
app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintTop_toTopOf="parent" />

<Button

android:id="@+id/button"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginBottom="144dp"

android:layout_marginLeft="148dp"

android:text="Submit"

app:layout_constraintBottom_toBottomOf="parent"

app:layout_constraintStart_toStartOf="parent" />

</LinearLayout>
Edit Text

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

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:app="http://schemas.android.com/apk/res-auto"

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

tools:context="example.javatpoint.com.edittextexample.MainActivity">

<EditText

android:id="@+id/editText1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentTop="true"

android:layout_centerHorizontal="true"

android:layout_marginTop="61dp"

android:ems="10"

android:inputType="text"

android:hint=?enter text?

tools:layout_editor_absoluteX="84dp"

tools:layout_editor_absoluteY="53dp" />

<EditText

android:id="@+id/editText2"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_below="@+id/editText1"

android:layout_centerHorizontal="true"

android:layout_marginTop="32dp"

android:ems="10"

android:inputType="password"
android:hint="enter password"

tools:layout_editor_absoluteX="84dp"

tools:layout_editor_absoluteY="127dp" />

<Button

android:id="@+id/button"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_below="@+id/editText2"

android:layout_centerHorizontal="true"

android:layout_marginTop="109dp"

android:text="Show Value"

tools:layout_editor_absoluteX="148dp"

tools:layout_editor_absoluteY="266dp" />

</RelativeLayout>

You might also like