Advertisement
mraps98

Change Color Android XML

Feb 18th, 2020
644
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.80 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.     xmlns:app="http://schemas.android.com/apk/res-auto"
  4.     xmlns:tools="http://schemas.android.com/tools"
  5.     android:layout_width="match_parent"
  6.     android:layout_height="match_parent"
  7.     android:id="@+id/constraintLayout"
  8.     tools:context=".MainActivity">
  9.  
  10.     <TextView
  11.         android:id="@+id/textView"
  12.         android:layout_width="wrap_content"
  13.         android:layout_height="wrap_content"
  14.         android:text="Welcome to My First Android Application"
  15.         app:layout_constraintBottom_toBottomOf="parent"
  16.         app:layout_constraintEnd_toEndOf="parent"
  17.         app:layout_constraintLeft_toLeftOf="parent"
  18.         app:layout_constraintRight_toRightOf="parent"
  19.         app:layout_constraintStart_toStartOf="parent"
  20.         app:layout_constraintTop_toTopOf="parent" />
  21.  
  22.     <Button
  23.         android:id="@+id/button1"
  24.         android:layout_width="wrap_content"
  25.         android:layout_height="wrap_content"
  26.         android:layout_marginStart="80dp"
  27.         android:layout_marginTop="93dp"
  28.         android:text="Black"
  29.         app:layout_constraintStart_toStartOf="parent"
  30.         app:layout_constraintTop_toBottomOf="@+id/textView"
  31.         android:onClick="changeColor"
  32.         />
  33.  
  34.     <Button
  35.         android:id="@+id/button2"
  36.         android:layout_width="wrap_content"
  37.         android:layout_height="wrap_content"
  38.         android:layout_marginTop="92dp"
  39.         android:layout_marginEnd="80dp"
  40.         android:text="White"
  41.         app:layout_constraintEnd_toEndOf="parent"
  42.         app:layout_constraintTop_toBottomOf="@+id/textView"
  43.         android:onClick="changeColor"
  44.         />
  45.  
  46.  
  47.  
  48. </androidx.constraintlayout.widget.ConstraintLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement