Sourav gupta
Sourav gupta

Reputation: 43

Checkbox not showing up on android layout

I have been trying to add a checkbox to my android app's layout but it is not showing up. The text field beside the checkbox is displayed but the checkbox itself remains invisible. How can this be fixed ?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.lenovo.myapplication.MainActivity"
    android:orientation="vertical"
    android:background="#0000ff"
    >

    <EditText
        android:id="@+id/message"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Write your name"
        android:textSize="50sp"
        android:inputType="text"
        android:layout_margin="16dp"
    />
    <TextView
        android:layout_margin="16dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Topping"
         android:textSize="50sp"/>
    <CheckBox
        android:layout_width="500sp"
        android:layout_height="50sp"
        android:text="new checkbox"
        android:textSize="50sp"
        android:scaleX="0.7"
        android:scaleY="0.7"
        android:buttonTint="#000000"
        />
</LinearLayout>

Upvotes: 1

Views: 2485

Answers (1)

Sudheesh R
Sudheesh R

Reputation: 1775

Try this checkbox xml

<CheckBox
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="new checkbox"
    android:textSize="16sp"
    android:scaleX="0.7"
    android:scaleY="0.7"
    android:buttonTint="#000000"/>

Upvotes: 3

Related Questions