1

ヘルプ情報、プログラムの使用方法の説明を表示する必要があります。ScrollView でカスタム XML を使用して AlertDialog を選択しました。タブレット、xperia neo、および 2 つの仮想デバイスでテストしました。そのうちの 3 つは問題なく動作しますが、画面が小さい 2.3 では、ダイアログが大きすぎて、視覚化にバグがあり、閉じにくくなっています。理由はありますか?ここに私のコードがあります: ScrollView の XML:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical" 
    android:textSize="10sp">
    </TextView>
</ScrollView>`

そして、それを呼び出すための私のコードについて:

AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage(R.string.msg_help)
           .setCancelable(false)
           .setView(LayoutInflater.from(this).inflate(R.layout.dialog_scrollable,null))
           .setTitle(R.string.help_title)
           .setPositiveButton("OK", new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) {
                    //do things
               }
           });
    AlertDialog alert = builder.create();
    alert.getWindow().setLayout(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    alert.show();

これがどのように見えるかです:http://postimg.org/image/wvg61x0qv/

4

1 に答える 1