Category : android-button

without ScrollView, my buttons look fine but after I use it, the buttons disappear, I tried a lot at solution but the thing appear is just <TextView>. How can I make them appear as preferred? activity_main.xml <RelativeLayout 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" tools:context=".MainActivity" android:background="@drawable/background"> <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" android:scrollbars="vertical"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margin="20dp" android:orientation="vertical"> <TextView android:id="@+id/HeaderText" ..

Read more

I understand that any XML elements with ID should be automatically pull into an activity class through view binding. However, Android Studio keeps suggesting that my button is a nullable and needs to have ?. or !!. for it to compile. If I assert non-nullable with !!., it actually result in a runtime NullPointerException for ..

Read more

I just started learning Android a few days ago. When I am playing around with Button today, I noticed that I am not able to set border as expected. xml files below: Button partin activity_main.xml: <Button android:layout_width="200sp" android:layout_height="100dp" android:background="@drawable/start_button_selector" app:backgroundTint="@color/start_button_color_selector" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias=".4" /> start_button_selector.xml: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/arrow_button"> <shape ..

Read more

I am coding a "set pin" fragment for the second time and it’s not working. Everything works great until I use switch blocks and View.OnTouchListener. I am trying to change the buttons background resource to a different drawable when pressed down and then back when finger is lifted. My problem is that the background resource ..

Read more