Button Background mit mipmap

  • hier ist der Code der XML Datei :)





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


    <android.support.constraint.ConstraintLayout 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"
    android:orientation="vertical"
    tools:context=".MainActivity">



    <Button
    android:id="@+id/male_btn"
    android:layout_width="160dp"
    android:layout_height="160dp"
    android:layout_gravity="center"
    android:layout_marginStart="8dp"
    android:layout_marginLeft="8dp"
    android:layout_marginEnd="8dp"
    android:layout_marginRight="8dp"
    android:layout_marginBottom="8dp"
    android:background="@mipmap/mars"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/gender_txt"
    app:layout_constraintVertical_bias="0.13999999"
    app:layout_constraintVertical_chainStyle="spread_inside" />


    <Button
    android:id="@+id/female_btn"
    android:layout_width="160dp"
    android:layout_height="160dp"
    android:layout_gravity="center"
    android:layout_marginStart="8dp"
    android:layout_marginLeft="8dp"
    android:layout_marginTop="8dp"
    android:layout_marginEnd="8dp"
    android:layout_marginRight="8dp"
    android:background="@mipmap/female"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/male_btn"
    app:layout_constraintVertical_chainStyle="spread_inside" />


    <TextView
    android:id="@+id/textView6"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:background="@color/colorPrimary"
    app:layout_constraintBottom_toTopOf="@+id/textView8"
    app:layout_constraintEnd_toEndOf="@+id/textView7"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textView9" />


    <TextView
    android:id="@+id/textView7"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="10dp"
    android:layout_marginLeft="10dp"
    android:layout_marginTop="8dp"
    app:layout_constraintStart_toEndOf="@+id/gender_txt"
    app:layout_constraintTop_toTopOf="@+id/gender_txt" />


    <TextView
    android:id="@+id/textView8"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="20dp"
    android:layout_marginLeft="20dp"
    android:layout_marginTop="6dp"
    app:layout_constraintStart_toEndOf="@+id/gender_txt"
    app:layout_constraintTop_toBottomOf="@+id/gender_txt" />


    <TextView
    android:id="@+id/textView9"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="10dp"
    android:layout_marginLeft="10dp"
    android:layout_marginBottom="6dp"
    app:layout_constraintBottom_toTopOf="@+id/gender_txt"
    app:layout_constraintStart_toEndOf="@+id/gender_txt" />


    <TextView
    android:id="@+id/gender_txt"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginStart="8dp"
    android:layout_marginLeft="8dp"
    android:layout_marginTop="50dp"
    android:text="@string/geschlechtwählen"
    android:textColor="#ffffff"
    android:textSize="20sp"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />



    </android.support.constraint.ConstraintLayout>

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!