這種做法最普遍最簡單:
1、新建一個android空項目;
2、在drawable目錄下添加圖標文件,如icon.png;在values目錄下的strings.xml文件中增加名稱,如websitename。
3、在配置文件AndroidManifest.xml中,增加鏈接的圖標icon和名稱websitename:
4、在MainActivity中編輯onCreate方法:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Uri uri = Uri.parse("https://blog.csdn.net/wanggsx918"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it); finish(); }
沒錯,就是這麼簡單!
如果想做得更好,就在應用中增加webview瀏覽器功能。