相关疑难解决方法(0)

像Google一样的Actionbar通知计数图标(徽章)

是否有Android标准徽章或方法来显示带有Google示例的计数的操作栏通知图标?

在图片上数3

如果没有,那么最好的方法是什么呢?
我是android的新手,请帮忙.

notifications icons android actionbarsherlock android-actionbar

142
推荐指数
5
解决办法
11万
查看次数

如何在ActionBar图标上获取文本?

我想要这样的东西:

在此输入图像描述

第3个图标用于通知,现在只是一个png图像.是否可以做某事,以便我可以改编文本/数字,即...,03以编程方式显示实际的通知号码.

谢谢

android actionbarsherlock android-actionbar

40
推荐指数
2
解决办法
3万
查看次数

在Android中实现自定义drawable

我试图在Android中掌握2D图形.作为一个例子,我想实现一个自定义drawable并在我的Activity中显示它

我通过扩展Android drawable来定义一个自定义的drawable,如下所述

 class myDrawable extends Drawable {

   private static final String TAG = myDrawable.class.getSimpleName();
   private ColorFilter cf;
   @Override
   public void draw(Canvas canvas) {


     //First you define a colour for the outline of your rectangle

     Paint rectanglePaint = new Paint();
     rectanglePaint.setARGB(255, 255, 0, 0);
     rectanglePaint.setStrokeWidth(2);
     rectanglePaint.setStyle(Style.FILL);

     //Then create yourself a Rectangle
     RectF rectangle = new RectF(15.0f, 50.0f, 55.0f, 75.0f); //in pixels


     Log.d(TAG,"On Draw method");
     // TODO Auto-generated method stub
     Paint paintHandl = new Paint();
     //  paintHandl.setColor(0xaabbcc);
     paintHandl.setARGB(125, 234, 213, 34 …
Run Code Online (Sandbox Code Playgroud)

android

12
推荐指数
1
解决办法
2万
查看次数

java.lang.ClassCastException: android.graphics.drawable.BitmapDrawable 不能转换为 android.graphics.drawable.LayerDrawable

在这些代码上生成错误: setBadgeCount(this,icon ,"0");

这是我的代码:

  MenuItem itemCart = menu.findItem(R.id.action_cart);
    LayerDrawable icon = (LayerDrawable) itemCart.getIcon();

    // Update LayerDrawable's BadgeDrawable

    setBadgeCount(this,icon ,"0");
Run Code Online (Sandbox Code Playgroud)

android android-studio

1
推荐指数
1
解决办法
1万
查看次数