parent
6ec43d1783
commit
43f22d2784
@ -0,0 +1,48 @@
|
||||
package com.example.androidtermwork.video;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.ViewStub;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.example.androidtermwork.LoginPage;
|
||||
import com.example.androidtermwork.R;
|
||||
import com.example.androidtermwork.RegisterFirstPage;
|
||||
|
||||
public class MapActivity extends AppCompatActivity {
|
||||
|
||||
private WebView webView;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_map);
|
||||
webView = findViewById(R.id.webview);
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
webView.setWebViewClient(new WebViewClient());
|
||||
webView.loadUrl("https://www.amap.com/");
|
||||
OnButtonToStory();
|
||||
}
|
||||
|
||||
public void OnButtonToStory() {
|
||||
Button regis = findViewById(R.id.story);
|
||||
regis.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
LinearLayout container = findViewById(R.id.rightLayout);
|
||||
ViewStub stub = findViewById(R.id.stub);
|
||||
stub.inflate();
|
||||
regis.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rightLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="MissingConstraints,WebViewLayout">
|
||||
|
||||
<WebView
|
||||
android:id="@+id/webview"
|
||||
android:layout_width="450dp"
|
||||
android:layout_height="400dp" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/stub"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout="@layout/activity_map_bottom" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/story"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/colorPrimary"
|
||||
android:text="点击获取当地红色故事">
|
||||
</Button>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in new issue