3
I am using an Activity that has the following elements:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
tools:context=".MapsActivity" />
<Button
android:id="@+id/evento_btn"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="215dp"
android:layout_marginBottom="25dp"
android:drawableBottom="@drawable/button" />
<Button
android:id="@+id/manu_btn"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="90dp"
android:layout_alignEnd="@+id/evento_btn"
android:layout_alignParentBottom="true"
android:layout_marginEnd="-86dp"
android:layout_marginBottom="18dp"
android:drawableBottom="@drawable/menu_btn" />
And I’m trying to hide the elements when the user clicks on the screen, to give more space for the user to interact with the map (same principle of google maps when you click on the map and the menu and the other buttons are hidden). For that I tried the following code:
manu_btn = (Button) findViewById(R.id.evento_btn);
evento_btn =(Button) findViewById(R.id.evento_btn);
manu_btn.setText("+0");
evento_btn.setText("+0");
handler = new Handler();
handler.postDelayed(runnable,7000);
}
Runnable runnable = new Runnable() {
@Override
public void run() {
evento_btn.setVisibility(View.INVISIBLE);
evento_btn.setVisibility(View.INVISIBLE);
}
};
It works, but it doesn’t fulfill what was proposed. Any idea how I can do this?
Yes, however I need the buttons to be hidden only when there is the touch on the screen and they return when the user touches again.
– Regina Moraes
You can make an onClickListener that has a boolean to know if it was clicked or not, you have already solved?
– Leonardo Dias