Skip to content

Commit

Permalink
Fixes codinguser#855 - Align text inside Toast, not Toast inside Screen
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanGarf committed Jan 5, 2020
1 parent 95cc386 commit 5bb9560
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.crashlytics.android.Crashlytics;
Expand Down Expand Up @@ -302,7 +303,13 @@ public void onClick(View v) {
mToast = Toast.makeText(getApplicationContext(),
R.string.double_back_press_exit_msg,
Toast.LENGTH_SHORT);
mToast.setGravity(Gravity.CENTER,0,0);

// Align-Center text inside the Toast
TextView toastTextView = (TextView) mToast.getView()
.findViewById(android.R.id.message);
if (toastTextView != null) {
toastTextView.setGravity(Gravity.CENTER);
}
}

@Override
Expand Down

0 comments on commit 5bb9560

Please sign in to comment.