我需要在usingwebview
的底部设置 a 的对齐方式,而不是 xml 布局。AbsoluteLayout
java code
我尝试了一些 Layoutparams 组合,但它们不起作用:
AbsoluteLayout al = (AbsoluteLayout) act.findViewById(R.id.ad);
WebView wv = new WebView(act);
wv.setScrollContainer(false);
wv.getSettings().setJavaScriptEnabled(true);
wv.setBackgroundColor(Color.TRANSPARENT);
String html = "<html><body style='margin:0;padding:0;'><script type='text/javascript' src='http://ad.leadboltads.net/show_app_ad.js?section_id=" + bannerId + "'></script></body></html>";
wv.loadData(html, "text/html", "utf-8");
al.addView(wv);
我无法编辑xml layout
,我必须在代码中进行。我不知道问题是否是AbsoluteLayout已被弃用?或者我必须将 webview 设置在底部而不是对齐absolutelayout。
情况是这样的,我有一个填充屏幕的Absolutelayout,我想设置webview填充宽度(现在默认情况下工作)并在底部对齐(默认情况下在顶部对齐)
我想工作的xml是这样的:(我不能修改它)
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/${YYAndroidPackageName}"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<${YYAndroidPackageName}.DemoGLSurfaceView
android:id="@+id/demogl"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<AbsoluteLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:id="@+id/ad" >
</AbsoluteLayout>
</FrameLayout>
对不起我的英语,谢谢你的帮助。