'Not able to click the logout and posy buttons

I have tried checking if any layout is overlapping or not. I have tried adding more space between the button and the border nothing seems to work. I'm not able to see where am I missing out

This is the activity where I'm trying to add setonclicklistenr:

public class addPost extends AppCompatActivity {
    ImageView picgal,postt;
    EditText descrip,compName;
    Button pst,logout;
    FirebaseAuth auth;
    FirebaseStorage storage;
    FirebaseDatabase database;
    Uri uri;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_add_post);
        picgal = findViewById(R.id.addpic);
        descrip = findViewById(R.id.postDescription);
        logout = findViewById(R.id.lgout);
        compName = findViewById(R.id.comm);
        auth = FirebaseAuth.getInstance();
        storage = FirebaseStorage.getInstance();

        logout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                auth.signOut();
                startActivity(new Intent(addPost.this,postActivity.class));
            }
        });

This is the xml file:

    <androidx.appcompat.widget.AppCompatButton
        android:id="@+id/lgout"
        android:layout_width="75dp"
        android:layout_height="40dp"
        android:layout_marginEnd="8dp"
        android:background="@drawable/post_button_blue"
        android:enabled="false"
        android:text="LOGOUT"
        android:textColor="#000000"
        app:layout_constraintBottom_toBottomOf="@+id/postButton"
        app:layout_constraintEnd_toStartOf="@+id/postButton"
        app:layout_constraintTop_toTopOf="@+id/postButton"
        tools:ignore="TouchTargetSizeCheck" />

    <TextView
        android:id="@+id/textView5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:fontFamily="@font/roboto_black"
        android:text="Create Post"
        android:textColor="@color/black"
        android:textSize="20sp"
        app:layout_constraintBottom_toBottomOf="@+id/postButton"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/postButton" />

    <androidx.appcompat.widget.AppCompatButton
        android:id="@+id/postButton"
        android:layout_width="75dp"
        android:layout_height="40dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="16dp"
        android:background="@drawable/post_button_white"
        android:enabled="false"
        android:text="post"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:ignore="TouchTargetSizeCheck" />

    <View
        android:id="@+id/view"
        android:layout_width="wrap_content"
        android:layout_height="1dp"
        android:layout_marginTop="8dp"
        android:background="#CFC9C9"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/postButton" />

    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="8dp"
        android:text="User1"
        android:textColor="@color/black"
        android:textSize="@dimen/_14font_mdp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/view" />

    <EditText
        android:id="@+id/comm"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="16dp"
        android:background="@android:color/transparent"
        android:ems="10"
        android:hint="Enter Company Name"
        android:inputType="textPersonName"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="@+id/name"
        app:layout_constraintTop_toBottomOf="@+id/name" />

    <EditText
        android:id="@+id/postDescription"
        android:layout_width="355dp"
        android:layout_height="287dp"
        android:layout_marginTop="5dp"
        android:layout_marginEnd="16dp"
        android:background="@android:color/transparent"
        android:ems="10"
        android:gravity="top"
        android:hint="Type to add your experience"
        android:inputType="textMultiLine"
        android:textSize="20sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="@+id/name"
        app:layout_constraintTop_toBottomOf="@+id/comm"
        tools:ignore="TouchTargetSizeCheck" />

    <ImageView
        android:id="@+id/postpic"
        android:layout_width="400dp"
        android:layout_height="272dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="10dp"
        android:layout_marginEnd="16dp"
        android:scaleType="centerCrop"
        android:visibility="gone"
        app:layout_constraintBottom_toTopOf="@+id/view3"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@+id/postDescription"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/postDescription"
        app:srcCompat="@drawable/img2"
        tools:visibility="invisible" />

    <ImageView
        android:id="@+id/addpic"
        android:layout_width="41dp"
        android:layout_height="43dp"
        android:layout_marginEnd="16dp"
        android:layout_marginBottom="8dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:srcCompat="@drawable/imgg" />

    <TextView
        android:id="@+id/textView7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:text="Add to post"
        android:textColor="@color/black"
        android:textSize="16sp"
        app:layout_constraintBottom_toBottomOf="@+id/addpic"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/addpic" />

    <View
        android:id="@+id/view3"
        android:layout_width="wrap_content"
        android:layout_height="1dp"
        android:layout_marginBottom="8dp"
        android:background="#CFC9C9"
        app:layout_constraintBottom_toTopOf="@+id/addpic"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

Screenshot of the .XML file design

enter image description here



Solution 1:[1]

I can See You are setting "enabled=false" in logout Button could you remove that part or replace with "enabled=true"...I will work if you do so ..please try

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Santosh Bhandary