小编kzs*_*kzs的帖子

在android imageview中旋转缩放拖动图像

我希望能够在android framelayout和imageview中旋转,缩放和移动图像.使用以下代码,我能够做到这一点.但是视图有时会脱离UI.你可以在ACTION_UP中处理旋转(每个ACTION_UP旋转90度)动作事件.以下是我的main.xml:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" >
   <ImageView android:id="@+id/imageView"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:src="@drawable/csf6a4_flipped"
         android:scaleType="matrix" >
   </ImageView>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)

以下是我的java文件:

package com.example.rotatezoommove;



import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.os.Bundle;
import android.util.FloatMath;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ImageView;

public class RotateZoomMove extends Activity implements OnTouchListener {
   private static final String TAG = "Touch";
   // These matrices will be used to move and zoom image
   Matrix matrix = new Matrix();
   Matrix savedMatrix = …
Run Code Online (Sandbox Code Playgroud)

graphics android image

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

使用android中的矩阵缩放和拖动图像

我得到以下代码(来自Ed Burnette的Hello android)工作得很好,我能够拖动和缩放图像.

import android.app.Activity;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.os.Bundle;
import android.util.FloatMath;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ImageView;

public class Touch extends Activity implements OnTouchListener {
   private static final String TAG = "Touch";
   // These matrices will be used to move and zoom image
   Matrix matrix = new Matrix();
   Matrix savedMatrix = new Matrix();

   // We can be in one of these 3 states
   static final int NONE = 0;
   static final int DRAG = …
Run Code Online (Sandbox Code Playgroud)

android drag-and-drop image zoom

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

android gps位置精确度圈

我有一个简单的活动,给出了用户的GPS位置.我想要做的是围绕gps位置绘制一个圆圈.圆圈给出了GPS定位精度的概念.例如,如果精度为6米,那么圆的半径将覆盖6米.以下是代码.

import java.util.List;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Point;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;

public class ShowMap extends MapActivity {

    private MapController mapController;
    private MapView mapView;
    private LocationManager locationManager;
    private GeoUpdateHandler geoUpdateHandler;

    @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.gps);
            mapView = (MapView) findViewById(R.id.mapview);
            mapView.setBuiltInZoomControls(true);
            mapView.setSatellite(true);
            mapController = mapView.getController();
            mapController.setZoom(14); // Zoom 1 is world view
            geoUpdateHandler …
Run Code Online (Sandbox Code Playgroud)

geometry gps android

8
推荐指数
2
解决办法
7663
查看次数

Android ArrayList迭代

我有一个存储区域名称的ArrayList.我想查看此列表以查找是否来自不同区域的任意人.如果他们来自不同的地区,我会做出决定.我用以下代码实现了这一点.注意,area_IdList和area_IdListduplicate本质上是相同的ArrayList.这个代码是高效的还是任何人都可以建议更高效的代码 提前致谢.

public List<String> area_IdList = new ArrayList<String>();
public List<String> area_IdListduplicate = new ArrayList<String>();

for (int i = 0; i < area_IdList.size(); i++) 
{  
    for (int k = 1; k< area_IdListduplicate.size(); k++)
    {
        String sa= area_IdListduplicate.get(k);
        String sb= area_IdList.get(i);
        if (!sa.equalsIgnoreCase(sb))
        { 
            some decision
        }
    }             
}
Run Code Online (Sandbox Code Playgroud)

android arraylist

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

在退出应用程序时停止gps

好吧,我已经尝试过Nicholas的解决方案,但是如果我按下后退按钮,因为应用程序搜索gps fix.so我上传所有代码和文件(除了icon.png和pen.png在drawables中)的项目.. .所以,可以从这里复制粘贴代码以查看最新情况.我的main.xml:

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/icon"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    />
<Button android:text="Start" 
android:id="@+id/Button01" 
android:layout_width="120px" 
android:layout_height="70px"
android:layout_gravity = "center_horizontal"
android:textSize="20px"
android:layout_marginTop="150px"
android:clickable="true"
></Button>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

接下来我的主要活动(GpsLocEx.java)

package com.example.gpslocex;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class GpsLocEx extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Button start = (Button) findViewById(R.id.Button01);
        start.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) { …
Run Code Online (Sandbox Code Playgroud)

gps android

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

与具有空白字符串的字符串比较

对不起,如果这是一个愚蠢的问题.我需要与一个名称进行比较,该名称有三个单词由一个空格分隔.如果名称为null或"This is Android"我会做某事,否则我会做其他事情.例如,以下代码是否正确进行此比较?

 if((name==null)||(name.equalsIgnoreCase("This is Android")))
     { 
      //start activity 1
      }
    else 
      {
        //start activity 2
       }
Run Code Online (Sandbox Code Playgroud)

java string-comparison

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

这个乌龟语句在语法上是否正确?

我想mybrandofmercedes在OWL中设置对类的限制,这在语法上是否正确?我应该有方括号,如下所示?

mynamespace: mybrandofmercedes rdf:type owl:Class;

mynamespace: mybrandofmercedes
[

rdf:type owl:Restriction;

owl:onProperty mynamespace:hasOwner;

owl:hasValue mynamespace: Anders

]
Run Code Online (Sandbox Code Playgroud)

rdf semantic-web owl turtle-rdf

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