add margins to text pages

This commit is contained in:
Ahmet Inan 2024-05-08 09:31:15 +02:00
parent f8d6f6ff49
commit 066e200653
2 changed files with 18 additions and 3 deletions

View file

@ -27,8 +27,10 @@ import android.provider.MediaStore;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
@ -620,9 +622,10 @@ public class MainActivity extends AppCompatActivity {
}
private void showTextPage(String message) {
TextView view = new TextView(this);
view.setText(Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY));
view.setMovementMethod(LinkMovementMethod.getInstance());
View view = LayoutInflater.from(this).inflate(R.layout.text_page, null);
TextView text = view.findViewById(R.id.message);
text.setText(Html.fromHtml(message, Html.FROM_HTML_MODE_LEGACY));
text.setMovementMethod(LinkMovementMethod.getInstance());
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.Theme_AlertDialog);
builder.setNeutralButton(R.string.close, null);
builder.setView(view);

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<TextView
android:id="@+id/message"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>