編輯:關於android開發
menu/share_action.xml
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/menu_item_share" android:title="Share" app:showAsAction="ifRoom" app:actionProviderClass="android.support.v7.widget.ShareActionProvider"/> </menu>
MainActivity
package com.panjn.sharedemo; import android.content.Intent; import android.support.v4.view.MenuItemCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.ShareActionProvider; import android.view.Menu; import android.view.MenuItem; import android.view.View; public class MainActivity extends AppCompatActivity { private Intent shareIntent; private ShareActionProvider mShareActionProvider; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_TEXT,"panjn.jpeg"); shareIntent.setType("text/plain*"); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.share_action,menu); MenuItem item = menu.findItem(R.id.menu_item_share); mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(item); setShareIntent(shareIntent); return true; } private void setShareIntent(Intent intent) { if(mShareActionProvider != null && intent != null) { mShareActionProvider.setShareIntent(intent); } } }
Android開發自學筆記(Android Studio) 目錄,androidstudio開發環境如下: 操作系統:Windows 10 Pro IDE:Androi
Binder中的asInterface解析,binderasinterface在使用AIDL通信的時候,在Stub類中都會生成一個asInterface函數,以《Andr
材料設計---Design,設計---design 效果: main_activity.xml <?xml version=1.0 encoding
Android studio 如何查看當前git 分支的4種方式,androidgit1、第一種 2、第二種 &n