I have a problem with the app (android studio, java).
- I added a textview over a button to style it.
- Initially, I set android:elevation="2" for the textview in XML, otherwise it doesn't appear at all.
- Now, when you press the button, the textview disappears.
- I tried to make a setOnTouchListener that sets the elevation for the button to 1, so the text appears after I stop pressing the button
- After i added the listener, the textview does not appear only when the button is held down.
I want the textview to remain visible at all times. Any tips? <3
learnButton.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
learnButton.setElevation(1);
return false;
}
});
<Button
android:id="@+id/buttonLearn"
android:layout_width="match_parent"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_height="100dp"
android:background="@drawable/style_bg_light"
android:layout_marginTop="125dp"
android:layout_centerHorizontal="true"/>
<TextView
android:id="@+id/textViewLearn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30dp"
android:fontFamily="@font/dosis"
android:text="Button Continue"
android:elevation="2dp"
android:layout_marginStart="12dp"
android:layout_marginTop="5dp"
android:textColor="@color/black"
android:layout_alignTop="@+id/buttonLearn"
android:layout_alignStart="@+id/buttonLearn"/>