Compare commits
1 commit
master
...
minimal-we
Author | SHA1 | Date | |
---|---|---|---|
1a1b53aaa6 |
1 changed files with 11 additions and 15 deletions
|
@ -8,26 +8,22 @@ import android.text.method.ScrollingMovementMethod;
|
|||
import android.view.MenuItem;
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.*;
|
||||
import android.view.ViewGroup.*;
|
||||
import android.util.Base64;
|
||||
|
||||
public class ExampleApp extends Activity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// creating LinearLayout
|
||||
LinearLayout linLayout = new LinearLayout(this);
|
||||
// specifying vertical orientation
|
||||
linLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
// creating LayoutParams
|
||||
LayoutParams linLayoutParam = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
|
||||
// set LinearLayout as a root element of the screen
|
||||
setContentView(linLayout, linLayoutParam);
|
||||
|
||||
LayoutParams lpView = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
||||
|
||||
TextView tv = new TextView(this);
|
||||
tv.setText("SUPERVIEalexW");
|
||||
tv.setLayoutParams(lpView);
|
||||
linLayout.addView(tv);
|
||||
WebView myWebView = new WebView(this);//activityContext);
|
||||
WebViewClient myWebViewClient= new WebViewClient();
|
||||
myWebView.setWebViewClient(myWebViewClient);
|
||||
String unencodedHtml = "<!DOCTYPE html><html><h1> this is html <h1> <h2> this is a h2</h2></html>";
|
||||
String encodedHtml = Base64.encodeToString(unencodedHtml.getBytes(),Base64.NO_PADDING);
|
||||
myWebView.loadData(encodedHtml, "text/html", "base64");
|
||||
//myWebView.loadUrl("https://alexmahr.de/ru");
|
||||
setContentView(myWebView);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue