Android ошибка с Button

Я обнаружил странную ошибку, у меня есть кнопка при нажатии на которую выпадает меню, и эта кнопка не имеет параметр background и всё работает но при добавлении background кнопка перестает работать. В чём проблема? введите сюда описание изображения

введите сюда описание изображения

XML

<?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"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/colorAccent"
            android:orientation="vertical">

            <Button
                android:id="@+id/btn"
                android:background="@color/colorPrimary"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="expand relativelayout" />

            <com.charles.expandablerelativelayout.ExpandableRelativeLayout
                android:id="@+id/collapseView1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:duration="0"
                app:expandable="false">

                <LinearLayout
                    android:id="@+id/ll_1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">
                    <Button
                        android:layout_width="125dp"
                        android:layout_height="125dp"/>

                </LinearLayout>



            </com.charles.expandablerelativelayout.ExpandableRelativeLayout>
        </LinearLayout>
    </ScrollView>
</RelativeLayout>

Java


public class ExpandActivity extends AppCompatActivity implements View.OnClickListener {
    private com.charles.expandablerelativelayout.ExpandableRelativeLayout mCollapseView1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        init();
    }

    private void init() {
        Button btn = findViewById(R.id.btn);
        btn.setOnClickListener(this);
        mCollapseView1 = findViewById(R.id.collapseView1);
        LinearLayout ll_1 = findViewById(R.id.ll_1);
        ll_1.setOnClickListener(this);


    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.btn) {
            mCollapseView1.toggle();
        } else {
            Toast.makeText(this, "tossss", Toast.LENGTH_SHORT).show();
        }
    }
}

Ответы (0 шт):