在以下示例中,如何将网页视图添加到导航扩展列表中?

时间:2018-12-01 07:48:32

标签: android-webview

我想将我的商业Instagram页面和Google地图地址添加到我的应用中,并尝试了不同的方法,但是都存在错误。 this is the menu and the green must show the a web page and then google map respectively

<LinearLayout
    android:background="@drawable/background"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

</LinearLayout>

<android.support.design.widget.NavigationView
    app:headerLayout="@layout/header"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:background="@color/white"
    app:itemTextColor="@color/Darkgray"
    app:itemIconTint="@color/Darkgray"
    app:menu="@menu/drawermenu"
    android:layout_gravity="start"
    >

import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;

public class MainActivity extends AppCompatActivity {
  private DrawerLayout mDrawerLayout;
  private ActionBarDrawerToggle mToggle;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer);
    mToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.open, R.string.close);
    mDrawerLayout.addDrawerListener(mToggle);
    mToggle.syncState();
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    if (mToggle.onOptionsItemSelected(item)) {
      return true;
    }

    return super.onOptionsItemSelected(item);
  }
}

0 个答案:

没有答案