小编pen*_*ang的帖子

在Java代码中围绕圆形路径绘制按钮需要帮助吗?

我可以得到圆形的中心点,所以我想在圆形的中心点周围绘制一些按钮,如图所示http://i.6.cn/cvbnm/50/97/b0/e7ed11251c3069fea4130c74b3ecb10c .png ,你能给我一些建议,链接到例子会更有用.这是我的代码

编辑:

public class drawCirPicture extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(new SampleView(this));
}

private static class SampleView extends View {
    private Bitmap mBitmap;




    public SampleView(Context context) {
        super(context);
        setFocusable(true);

        InputStream is = context.getResources().openRawResource(android.R.drawable.sym_call_outgoing);
        mBitmap = BitmapFactory.decodeStream(is);

    }

    @Override protected void onDraw(Canvas canvas) {
        canvas.drawColor(Color.GRAY);

        Paint p = new Paint();
        float centerY = 200;
        float centerX=130;

       double alpha = 0,wedge=0;
       double PI=Math.PI;

        float x,y; …
Run Code Online (Sandbox Code Playgroud)

android

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

如何使用 Retrofit 发布数组参数?

我想post数据如下:

   {
     "user_id":"14545646",
    "list":["4545645","4545645","4545645","4545645"]
   }
Run Code Online (Sandbox Code Playgroud)

我使用了以下Retrofit方法:

interface DeleteOrder {

         @FormUrlEncoded
         @POST("/api/shop/deleteOrder.json")
         void getPoJoDeleteOrder(@Field("user_id") String user_id, @Field("list") String[] list,Callback<PoJoDeleteOrder> callback);

      }
Run Code Online (Sandbox Code Playgroud)

这是正确的方法吗?

retrofit

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

如何在画布和路径中进行抗锯齿处理

我遇到麻烦当我使用canvas.clipPath,它显示锯齿,它看起来不顺利,我知道如果我使用Paint,我可以使用mPaint.setFlags(Paint.ANTI_ALIAS_FLAG),这可以抗锯齿,但在我的代码中,我不能用油漆.

public static void drawCurrentPageArea(Canvas canvas, Bitmap bitmap) {
    //cebakhja


    canvas.save();
    canvas.clipPath(getPath5(), Region.Op.XOR);
    canvas.drawBitmap(bitmap, 0, 0, null);
    canvas.restore();
}

public static Path getPath5()
{
    Path mPath5 = new Path();

    mPath5.moveTo(ptc.x, ptc.y);
    mPath5.quadTo(pte.x, pte.y, ptb.x,ptb.y);
    mPath5.lineTo(pta.x, pta.y);
    mPath5.lineTo(ptk.x, ptk.y);
    mPath5.quadTo(pth.x, pth.y, ptj.x,ptj.y);
    mPath5.lineTo(ptf.x, ptf.y);
    mPath5.close();
    return mPath5;
}
Run Code Online (Sandbox Code Playgroud)

你可以看到我使用canvas.drawBitmap(bitmap,0,0,null); paint是null.如果我需要添加一个颜料,你能有一些建议吗?图为http://i.6.cn/cvbnm/36/5c/20/5d8d20e3bafe432d792793509f99131e.jpg

编辑:我设置的绘画为空,但不是效果

android android-canvas

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

使用画布在另一个矩形的中心绘制图像

在我看来,我有一个大矩形,矩形可以移动.当矩形移动到某个地方时,我想在大矩形的中心绘制图像.我的问题是我无法将图像的中心放在矩形的中心.我用了:

 canvas.drawBitmap(rotatedBitmap, matrix, paint)
 canvas.drawBitmap(rotatedBitmap, left, top, paint)
Run Code Online (Sandbox Code Playgroud)

但我找不到canvas.drawBitmap(rotateBitmap,centerX,centerY,paint),所以我想使用矩阵,但矩阵也从左边和顶部开始移动图像,而不是从中心移动,你能给出一些线索来绘制图片在矩形的中心?

android android-canvas

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

将图像叠加到相机预览SurfaceView上以及如何保存它们?

我有一个用于绘制图像的SurfaceView,我想将它们叠加到手机相机的实时信息中.我已经在相机预览surfaceview上阅读了Overlay图像, 以及如何在android上的相机使用的surfaceview上绘制叠加层

    public class TestCameraOverlayActivity extends Activity { 
         Bitmap bitmap;

         /** Called when the activity is first created. */ 
         @Override 
         public void onCreate(Bundle savedInstanceState) { 
               super.onCreate(savedInstanceState); 
               requestWindowFeature(Window.FEATURE_NO_TITLE); 
               Preview mPreview = new Preview(this); 
               DrawOnTop mDraw = new DrawOnTop(this); 
               bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
               setContentView(mPreview); 
               addContentView(mDraw, new LayoutParams (LayoutParams.WRAP_CONTENT,
               LayoutParams.WRAP_CONTENT)); 
        } 

        class DrawOnTop extends View { 
            public DrawOnTop(Context context) { 
                super(context); 

        } 

        @Override 
        protected void onDraw(Canvas canvas) { 
            Paint paint = new Paint(); 
            paint.setStyle(Paint.Style.STROKE); 
            paint.setColor(Color.BLACK); 
            canvas.drawText("Test Text", 10, 10, …
Run Code Online (Sandbox Code Playgroud)

android

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

如何禁用通过 BOOT_COMPLETED 运行应用程序

我想做一个任务管理器软件,我想检查所有使用 android.intent.action.BOOT_COMPLETED 的应用程序,并且我还想在移动设备开始运行时禁用自动启动。我不知道,如果我需要 root 权限才能完成它,可能会收到任何建议

android

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

UILocalNotification点击事件

我的代码是:

- (void) socketIO:(SocketIO *)socket didReceiveEvent:(SocketIOPacket *)packet
{
NSLog(@"didReceiveEvent(),%@",packet.data );



SysNotification *sysNotification=[GlobalVariable parseSysNotificationWithString:packet.data];


UILocalNotification *alarm = [[UILocalNotification alloc] init];
if (alarm) {
    alarm.fireDate = [NSDate date];
    alarm.timeZone = [NSTimeZone defaultTimeZone];
    alarm.repeatInterval = 0;
    alarm.soundName = UILocalNotificationDefaultSoundName;
    alarm.alertBody = @"Test message...";

    NSDictionary *infoDic = [NSDictionary dictionaryWithObject:@"name" forKey:@"key"];
    alarm.userInfo = infoDic;


    [[UIApplication sharedApplication] presentLocalNotificationNow:alarm];
}


}
Run Code Online (Sandbox Code Playgroud)

我想当我点击状态栏上的UILocalNotification,我可以来一些视图controller.how做什么?谢谢

iphone ios

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

存折通行证无法使用“\r\n”输入换行符

我正在使用存折,并且有一些输入值,如下所示:

{
    "key" : "terms",
    "label" : "terms_contions",
    "value" : "1.aaaaaaa
               2.bbbbbbb 
               3.ccccccc
               4.ddddddd
} 
Run Code Online (Sandbox Code Playgroud)

我使用“enter”键,我想换行以查看该值,但传递显示错误。

所以我将其修改为:

{
    "key" : "terms",
    "label" : "terms_contions",
    "value" : "1.aaaaaaa 2.bbbbbbb 3.ccccccc 4.ddddddd
}
Run Code Online (Sandbox Code Playgroud)

一切都很好,但我不想 1. 2. 3. 4.一行。我想要4条线。我怎样才能做到这一点?

ios passbook

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

UITableViewCell重用良好的做法

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {


    static NSString *CellIdentifier = @"NotificationViewCell";
    CardViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if(cell==nil){

        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CardViewCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];


        cell.contentView.backgroundColor=[UIColor clearColor];
        [ModelClass addSublayer:cell.contentView];


        cell.cellbg.layer.cornerRadius = 8;
        cell.cellbg.layer.masksToBounds = YES;

         cell.cellbg.layer.borderWidth = 1;
         cell.cellbg.layer.borderColor = [[UIColor grayColor] CGColor];


        cell.logoImage.layer.cornerRadius = 8;
        cell.logoImage.layer.masksToBounds = YES;

        cell.logoImage.layer.borderWidth = 1;
        cell.logoImage.layer.borderColor = [[UIColor grayColor] CGColor];



        Merchant *merchantList= [self.cardListArr objectAtIndex:indexPath.row];

        cell.nameLab.text=merchantList.name;

        NSLog(@"merchantList.myloyalty.points=%@",merchantList.myloyalty.points);
    //    NSLog(@"memberNO=%@",merchantList.myloyalty.memberNO);
        cell.integralLab.text=[NSString stringWithFormat:NSLocalizedString(@"points_dot", @"") ,[merchantList.myloyalty.points intValue]];


        cell.cardNumberLab.text=[NSString stringWithFormat:@"%@%@",NSLocalizedString(@"ID", nil), merchantList.myloyalty.memberNO];



        if(![ModelClass …
Run Code Online (Sandbox Code Playgroud)

iphone uitableview ios

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

此NSPersistentStoreCoordinator没有持久存储.它无法执行保存操作

我读过在我的XCode数据模型上发生任何变化后,我继续"保存操作失败"

错误代码:

  This NSPersistentStoreCoordinator has no persistent stores.  It cannot perform a save operation.
 (null)
 (
0   CoreFoundation                      0x36aeb8a7 __exceptionPreprocess + 186
1   libobjc.A.dylib                     0x32f02259 objc_exception_throw + 32
2   CoreData                            0x353a8fe7 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 282
3   CoreData                            0x35411287 -[NSManagedObjectContext save:] + 522
4   myshine                             0x001a1e59 _mh_execute_header + 1293913
5   myshine                             0x0006cacd _mh_execute_header + 27341
6   myshine                             0x000aa829 _mh_execute_header + 280617
7   myshine                             0x000abe07 _mh_execute_header + 286215
8   myshine                             0x0009a12b _mh_execute_header + 213291
9   myshine                             0x00099fb3 _mh_execute_header + 212915
10 …
Run Code Online (Sandbox Code Playgroud)

iphone core-data ios

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