2
我正在從網站獲取數據並放置在文本視圖中,以便我可以使用setGravity(Gravity.CENTER)將其居中。但是,當我將文本視圖放在警報對話框中時,我無法再向下滾動查看消息的結尾。有人可以幫我解決這個問題嗎?謝謝警報對話框中的TextView不會向下滾動
TextView msg1=new TextView(Welcome.this);
//Takes data from a website
msg1.setText(Html.fromHtml(getText("http://www.cellphonesolutions.net/welcome-en")));
msg1.setGravity(Gravity.CENTER);
LinearLayout dialogLayout = new LinearLayout(Welcome.this);
dialogLayout.addView(msg1);
dialogLayout.setOrientation(LinearLayout.VERTICAL);
AlertDialog welcome = new AlertDialog.Builder(Welcome.this).create();
welcome.setView(dialogLayout);
welcome.setButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//rest of the code....
完美,謝謝(我會投了,但我仍然在15 REP) – Sean