2015-05-22 30 views
0

我有 Fragment,我可以,當我touch Button關於我 - >移動Fragment AboutUs;我重複約10次。Android webView InAppBrowserFragment錯誤侵犯菜單

錯誤是相同的圖片。 每個人都可以幫助我嗎?謝謝:

代碼Fragment負荷WebView

public class InAppBrowserFragment 
     extends BaseFragment { 

    private static final String LINK_PAGE = "linkPage"; 
    private static final String TITLE_ACTION_BAR = "titleActionBar"; 

    @InjectView(R.id.web_settings) 
    WebView mWebViewSettings; 
    @InjectView(R.id.actionbar_settings_sub) 
    ActionBar mActionBar; 
    @InjectView(R.id.img__settings_background) 
    ImageView mImgSettingsBackground; 

    /** 
    * Static method used to create an instance for this fragment. 
    * 
    * @return New instance of Fragment. 
    */ 
    public static InAppBrowserFragment newInstance(String titleActionBar, 
                String linkPage) { 
     final InAppBrowserFragment fragment = new InAppBrowserFragment(); 
     final Bundle data = new Bundle(); 
     if (titleActionBar != null) { 
      data.putString(LINK_PAGE, 
          linkPage); 
      data.putString(TITLE_ACTION_BAR, 
          titleActionBar); 
     } 

     // Attach data with fragment. 
     fragment.setArguments(data); 

     return fragment; 
    } 

    @Override 
    protected int getLayoutResourceId() { 
     return R.layout.fragment_in_app_browser; 
    } 

    @Override 
    protected void initUi(final Bundle savedInstanceState) { 
     String titleActionBar = getArguments().getString(TITLE_ACTION_BAR); 
     //set background 
     CommonUtil.displayImage(getActivity(), 
           CommonUtil.getDrawableResource(R.drawable.img_random_frontpage_1), 
           this.mImgSettingsBackground, 
           0, 
           0, 
           0, 
           true, 
           false, 
           null); 
     //set UI Action Bar 
     this.mActionBar.setupUI(null, 
           titleActionBar, 
           R.drawable.ab_ic_back, 
           0, 
           ""); 
     this.mActionBar.setButtonRightPadding(0); 
     this.mActionBar.setButtonLeftListener(new ActionBar.IActionBarButtonLeftListener() { 
      @Override 
      public void onButtonLeftClicked(final View view) { 
       popBack(true); 
       mWebViewSettings.canGoBack(); 
      } 
     }); 

    } 

    @Override 
    protected void loadData(final Bundle savedInstanceState) { 
     String linkPage = getArguments().getString(LINK_PAGE); 
     // Init webview setting 
     WebSettings settings = mWebViewSettings.getSettings(); 

     settings.setJavaScriptEnabled(true); 
     settings.setBuiltInZoomControls(true); 
     settings.setDisplayZoomControls(true); 
     settings.setSupportZoom(true); 
     mWebViewSettings.setWebViewClient(new WebViewClient() { 
      public boolean shouldOverrideUrlLoading(WebView view, String url) { 
       view.loadUrl(url); 
       return true; 
      } 

      public void onPageFinished(WebView view, String url) { 

      } 

      public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { 

      } 
     }); 
     mWebViewSettings.loadUrl(linkPage); 
    } 
} 

Conrect: enter image description here

Inconrect: enter image description here

回答

0

我修復sucess :(集WRAP_CONTENT爲網頁視圖

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      style="@style/CreateTrips.Widget.ScreenContent.Fragment"> 

    <ImageView 
     android:id="@+id/img__settings_background" 
     style="@style/CreateTrips.Widget.BackgroundImage" 
     android:contentDescription="@null"/> 

    <com.createtrips.ui.widgets.ActionBar 
     android:id="@+id/actionbar_settings_sub" 
     style="@style/CreateTrips.Widget.ActionBar"/> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/white" 
     android:layout_marginTop="@dimen/widget_action_bar_height" 
     > 
    <WebView 
     android:id="@+id/web_settings" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     /> 
    </LinearLayout> 
</FrameLayout>