package com.example.example2;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.Button;
public class MainActivity extends Activity {
WebView web1;
WebView web2;
Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final String str1 = "<html>This first Html data</html>";
final String str2 = "<br /><br />Read the handouts please for tomorrow.<br /><br /><!--homework help homework"
+ "help help with homework homework assignments elementary school high school middle school"
+ "// --><font color='#60c000' size='4'><strong>Please!</strong></font>"
+ "<img src='http://www.homeworknow.com/hwnow/upload/images/tn_star300.gif' />";
web1 = (WebView) findViewById(R.id.webfirst);
web2 = (WebView) findViewById(R.id.websecond);
btn = (Button) findViewById(R.id.compare);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
web1.loadDataWithBaseURL("", str1, "text/html", "UTF-8", "");
web2.loadDataWithBaseURL("", str2, "text/html", "UTF-8", "");
// we have display This on Alert view with spliting .
}
});
}
}
这是我的分割视图活动,当我点击按钮时,我们能够在网页视图中看到具有拆分活动的数据但是我必须这样做,当我点击按钮然后字符串1和字符串2应该在Pop窗口中显示分裂数据的活动如何在Android中拆分警报或弹出视图请帮助我无法做到这一点我已经累了但是没有得到如何生病了
答案 0 :(得分:0)
让你的活动在清单中对话是单向的
<activity android:theme="@android:style/Theme.Dialog" />
通过在您的活动中添加上述代码,您可以将活动视为对话框
<强>(OR)强>
尝试以这种方式显示自定义对话框
Dialog dialog_help = new Dialog(getActivity());
dialog_help.setContentView(R.layout.help_screen);
TextView tv_1 = (TextView) dialog_help.findViewById(R.id.tv_help_1);
tv_1.setText("");
dialog_help.setCancelable(true);
dialog_help.setTitle(" Help ");
dialog_help.setCanceledOnTouchOutside(true);
dialog_help.show();
dialog_help.getWindow().setGravity(Gravity.CENTER);
dialog_help.getWindow().setLayout(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);