小编kar*_*tas的帖子

如何在画布上设置动画 - android

是否可以将动画师附加到路径?有没有其他方法在画布上绘制动画线条?在我发布之前我搜索了这个,但没有任何关于这一点.在这里这里的另外两个帖子有解决方案,并不适合我.

我在onDraw方法中发布我的代码以指定我想要的内容.

paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeWidth(2);
    paint.setColor(Color.BLACK);

    Path path = new Path();
    path.moveTo(10, 50);   // THIS TRANSFORMATIONS TO BE ANIMATED!!!!!!!!
    path.lineTo(40, 50);
    path.moveTo(40, 50);
    path.lineTo(50, 40);
    // and so on...


    canvas.drawPath(path, paint);
Run Code Online (Sandbox Code Playgroud)

有任何想法吗????

animation android canvas path

33
推荐指数
2
解决办法
5万
查看次数

获取点击地图伪造0.5.1 MapView的位置的纬度和经度

我使用地图伪造0.5.1库(api参考)我已遵循所有官方说明但我有以下问题:

我已经附上了一个onTouchListener

(org.mapsforge.map.android.view.MapView)MapView类

但是当我尝试调用方法mapView.getProjection()时,我得到错误"无法解析方法getProjection().即使在许多在线示例中调用该方法,也没有在官方api引用或MapView中.class.org.mapsforge.map.android.view.MapView

 org.mapsforge.map.android.view.MapView mapView;
 mapView.setOnTouchListener(new View.OnTouchListener(){

        @Override
        public boolean onTouch(View v, MotionEvent ev) {
            int actionType = ev.getAction();
            switch (actionType) {
                case MotionEvent.ACTION_DOWN:

                    return false;

                case MotionEvent.ACTION_UP:
                    mapView.getProjection(); // the error is here

                    return true;
                case MotionEvent.ACTION_MOVE:
                    return false;
            }
            return false;
        }
    });
Run Code Online (Sandbox Code Playgroud)

有没有其他方法可以使用mapsforge lib获取分接点的纬度和经度?难道我做错了什么?如果在点击后没有办法获得坐标,我认为图书馆遗漏了一些非常重要的东西.

谢谢

java android geolocation mapsforge

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

使用pinterest应用程序打开pinterest链接(如果存在)-android

我想知道是否存在相应的方法来打开带有pinterest应用程序的pinterest链接(如果已安装),或者通过浏览器打开(如果它不在Facebook之类的设备中)。对于Facebook,我使用以下代码

            final String urlFb = "fb://page/" + "profile_id";
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(urlFb));

            // If a Facebook app is installed, use it. Otherwise, launch
            // a browser
            final PackageManager packageManager = getPackageManager();
            List<ResolveInfo> list =
                    packageManager.queryIntentActivities(intent,
                            PackageManager.MATCH_DEFAULT_ONLY);
            if (list.size() == 0) {
                final String urlBrowser = "https://www.facebook.com/" + "profile id";
                intent.setData(Uri.parse(urlBrowser));
            }

            startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

java android android-intent android-activity pinterest

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

尝试从DCIM获取图片时出现奇怪的行为

我正在尝试从DCIM加载我的活动中的图片.我使用以下代码:

int BROWSE_PICTURES = 0;
public void openBrowsePictures() {
    Intent i = new Intent(Intent.ACTION_PICK,MediaStore.Images.Media.EXTERNAL_CONTENT_URI);

    startActivityForResult(i, BROWSE_PICTURES);
}
Run Code Online (Sandbox Code Playgroud)

并在onActivityResult中:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == BROWSE_PICTURES && resultCode == RESULT_OK && null != data) { // we have bitmap from filesystem!
        Uri selectedImage = data.getData();
        Log.d("CAMERA","____"+selectedImage.toString());


        String[] filePathColumn = {MediaStore.Images.Media.DATA};



        Cursor cursor = getContentResolver().query(
                selectedImage, filePathColumn, null, null, null);
        cursor.moveToFirst();

        int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
        Log.d("CAMERA", " column : " + columnIndex); …
Run Code Online (Sandbox Code Playgroud)

java android picturegallery android-intent

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