내 애플리케이션에 WebView를로드하고 있습니다. AppBar를 활성화했으며 WebView가로드 될 때까지 기다리는 동안 표시합니다. 페이지가로드되면 새로운 활동이 열리고 내 AppBar가 자체 활동으로 대체 된 것처럼 보입니다. 이 경우 부모 작업으로 돌아가는 적절한 위로 버튼이 마음에들 것입니다. (뒤로 버튼은 위로 버튼과 같이 작동하고 싶습니다.) 그대로, 뒤로 버튼은 제가 여기서 어떻게 나갔는지 이해할 수없는 xml 레이아웃으로 되돌아갑니다.Android WebView가 AppBar을 잃습니다
<RelativeLayout 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"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.realpayment.app.activities.ReadMessage"
android:background="@color/c_black">
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:elevation="4dp"
android:theme="@style/JupiterTheme"
app:popupTheme="@style/ThemeOverlay.AppCompat"/>
<WebView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/calledAction"
android:layout_margin="15px"
android:layout_below="@+id/my_toolbar"
android:textColor="@color/c_white"
/>
그리고 나는 어떤 도움을
WebView browser = (WebView) findViewById(R.id.calledAction);
browser.loadUrl(sCallToActionLink);
감사와
Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
setSupportActionBar(myToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
나는 웹 페이지 로딩하고
과에서 onCreate 내 appbar를 초기화하고!
좋은 생각이지만 새로운 활동을 시작한 것으로 보입니다. 따라서 작동하지 않았습니다. 나는 그 화면에 거의 프레임처럼 유지하려고 노력하고있다. –
당신은 webview에서 url을 로딩하고있다. 새로운 활동이 어떻게 시작되는지 나는 이해하지 못했다. –
나는 동의한다, 나는 어느 쪽도 이해하지 못한다. 레이아웃에서 설명한 화면 (WebView의 경우 비어있는 화면)을 본 다음 전체 화면 브라우저를 움직이게됩니다. 그 시점에서 뒤로 버튼을 누르면 공백 레이아웃으로 돌아갑니다. 그것은 새로운 활동 인 것처럼 느껴지지만 솔직히 그것이 무엇을하는지 모릅니다. –