(FAB)在webview应用程序上带有(共享提供程序)的“浮动操作”按钮

时间:2016-06-12 14:20:04

标签: android facebook webview share whatsapp

我想在我的webview上使用android浮动操作按钮(FAB)作为共享操作按钮>>分享当前的网址(facebook - whatsapp ....等)

这是代码

public class MainActivity extends AppCompatActivity
    implements NavigationView.OnNavigationItemSelectedListener {

//initializing webview
private WebView mwebView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });

1 个答案:

答案 0 :(得分:0)

这对我有用..

How to activate "Share" button in android app?

如果您想使用(操作栏按钮)进行共享和刷新

,也请检查此项

Set sharing intent using icon in action bar