Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
L
LuckyFarm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王雪伟
LuckyFarm
Commits
2af46c8d
Commit
2af46c8d
authored
Oct 23, 2020
by
maxiaoliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改webview
parent
ad52538d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
25 deletions
+13
-25
WebViewActivity.java
...rc/main/java/com/ym/library/activity/WebViewActivity.java
+3
-13
activity_webview.xml
library/src/main/res/layout/activity_webview.xml
+10
-12
No files found.
library/src/main/java/com/ym/library/activity/WebViewActivity.java
View file @
2af46c8d
...
...
@@ -47,20 +47,14 @@ public class WebViewActivity extends BaseActivity {
}
else
{
rl
.
setVisibility
(
View
.
GONE
);
}
layout
=
findViewById
(
R
.
id
.
activity_webview_layout
);
initWebView
();
webView
=
findViewById
(
R
.
id
.
activity_webview_layout
);
initTitle
();
initWebView
();
}
private
void
initWebView
()
{
LinearLayout
.
LayoutParams
layoutParams
=
new
LinearLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
MATCH_PARENT
);
webView
=
new
WebView
(
this
);
webView
.
setBackgroundColor
(
getResources
().
getColor
(
R
.
color
.
color_FEDA83
));
//设置WebView的宽高
webView
.
setLayoutParams
(
layoutParams
);
//把webView添加到容器中
layout
.
addView
(
webView
);
webView
.
getSettings
().
setUseWideViewPort
(
true
);
webView
.
getSettings
().
setLoadWithOverviewMode
(
true
);
// webView.getSettings().setDefaultFontSize(56);
...
...
@@ -106,7 +100,7 @@ public class WebViewActivity extends BaseActivity {
finish
();
}
});
TextView
tv_title
=
findViewById
(
R
.
id
.
tv_user_t
oolbar_t
itle
);
TextView
tv_title
=
findViewById
(
R
.
id
.
tv_user_title
);
tv_title
.
setText
(
title
);
}
...
...
@@ -135,11 +129,7 @@ public class WebViewActivity extends BaseActivity {
protected
void
onDestroy
()
{
super
.
onDestroy
();
if
(
webView
!=
null
)
{
webView
.
clearView
();
webView
.
removeAllViews
();
webView
.
destroy
();
webView
=
null
;
layout
.
removeView
(
webView
);
}
}
...
...
library/src/main/res/layout/activity_webview.xml
View file @
2af46c8d
...
...
@@ -9,35 +9,33 @@
android:layout_width=
"match_parent"
android:layout_height=
"90dp"
android:background=
"#994B00"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:layout_alignParentBottom=
"true"
>
<ImageView
android:id=
"@+id/id_iv_back"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:
src=
"@drawable/icon_webview_back
"
android:
layout_centerVertical=
"true
"
android:layout_marginLeft=
"14dp"
android:layout_centerVertical=
"true"
/>
android:src=
"@drawable/icon_webview_back"
/>
<TextView
android:id=
"@+id/tv_user_t
oolbar_t
itle"
android:id=
"@+id/tv_user_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:textColor=
"#ffffffff"
android:textSize=
"18sp"
android:textStyle=
"bold"
android:layout_centerInParent=
"true"
/>
android:textStyle=
"bold"
/>
</RelativeLayout>
</RelativeLayout>
<
LinearLayout
<
WebView
android:id=
"@+id/activity_webview_layout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
>
</LinearLayout>
android:layout_height=
"match_parent"
/>
</LinearLayout>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment