2013-11-25 95 views
1

我想在我的Android應用中包含這個圖標,但我不知道它叫什麼。下面是圖標:這個圖標叫什麼?

enter image description here

我試圖找到它在@android:繪製和從谷歌圖標包,但我找不到它。

回答

0

簡單的方法是,下載它,把它/drawable/下,那麼你可以通過getDrawable()

0

從URL拉下:

//Creates an http connection 
HttpURLConnection httpConnection = (HttpURLConnection)new URL(url).openConnection(); 
httpConnection .setRequestProperty("User-agent","Mozilla/4.0"); 
httpConnection .connect(); 

//Pulls down the image 
InputStream input = httpConnection .getInputStream(); 
Bitmap bitmap = BitmapFactory.decodeStream(input); 

//Creates a drawable from the bitmap 
Drawable drawable = new BitmapDrawable(bitmap); 

使用本地文件在res /繪製/的icon.png

Drawable myIcon = getResources().getDrawable(R.drawable.icon); 
3

上面的答案是正確的,但請記住,如果你只是引用一個android drawable,他們可以在任何時候改變它們。只需要自行下載該drawable可能會更安全,特別是如果您想從美學角度對其進行任何控制時更是如此。 Android Asset Studio可讓您以任何您想要的方式爲其着色,並以所有varios dpi大小下載。

+0

這是更多的評論或編輯,真的。 –

+0

是的,但因爲我還是新的StackOverflow,我不允許添加評論到現有的答案。 – GrouchyPanda