我有一个很好的工作TouchImageView,我想知道它是如何工作的代码:我只想做的是能够捏缩放,或使用双击放大我选择的任何imageview,当我缩放我返回图像的原始大小.TouchImageView.java:
public class TouchImageView extends ImageView {
Matrix matrix = new Matrix();
static final int NONE = 0;
static final int DRAG = 1;
static final int ZOOM = 2;
int mode = NONE;
PointF last = new PointF();
PointF start = new PointF();
float minScale = 1f;
float maxScale = 3f;
float[] m;
float redundantXSpace, redundantYSpace;
float width, height;
static final int CLICK = 3;
float saveScale = 1f;
float right, bottom, origWidth, origHeight, bmWidth, bmHeight;
ScaleGestureDetector mScaleDetector;
Context …Run Code Online (Sandbox Code Playgroud) 我正在使用Cocos2dx 3.0 RC1,并在安装中输入: ./setup.py
我输入了NDK根目录和SDK根目录,但没有按照本教程中的说明在ANT根目录中放置任何内容:here
。但是知道我何时使用:cocos run -s ~/MyCompany/MyGame -p android,它说未定义我的ANT_ROOT。我已经使用Macport安装了它,但是当我键入ant时,它说Build丢失了。
我只想使用Cocos2dx在Android中创建游戏。
我知道如何解决问题,但问题是,我的.android目录变得不可见,我不知道如何删除它.我试过命令行,如:rmdir/S.android,它没有用.我在Mac上.
我看到了一些自动登录的教程例如这个链接,但是当我第一次使用该应用程序时,如何检查登录名和密码是否已经插入到"首选项活动"中?我应该放什么条件?
我试图在我的所有应用程序中放置一种样式,所以我创建了一个包含我的样式的主题:
<resources>
<style name="MyTheme" parent="android:Theme.Holo.Light">
<item name="android:textAppearance">@style/subtitle</item>
</style>
<style name="subtitle parent="@android:style/TextAppearance">
<item name="android:textColor">@color/purple</item>
<item name="android:textSize">40sp</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
但textAppearance不起作用它保持不变,但是当我textColor在我的主题中放入类似的东西时,它起作用了
如何在Android上显示MapBox图块?我尝试将它与OSMDroid一起使用,而Nutiteq则没有成功.MapBox有一个android库吗?
例如,我使用此代码在OSMDroid上实现MapBox:http://blog.spatialnetworks.com/post/2012/07/using-mbtiles-on-android-with-osmdroid
XYTileSource MBTILESRENDER = new XYTileSource("mbtiles", ResourceProxy.string.offline_mode, 1, 20, 256, ".png", "http://example.org/");
DefaultResourceProxyImpl mResourceProxy = new DefaultResourceProxyImpl(this.getApplicationContext());
SimpleRegisterReceiver simpleReceiver = new SimpleRegisterReceiver(this.getActivity());
File f = new File(Environment.getExternalStorageDirectory(), "mymbtilesfile.mbtiles");
IArchiveFile[] files = { MBTilesFileArchive.getDatabaseFileArchive(f) };
MapTileModuleProviderBase moduleProvider = new MapTileFileArchiveProvider(simpleReceiver, MBTILESRENDER, files);
MapTileProviderArray mProvider = new MapTileProviderArray(MBTILESRENDER, null, new MapTileModuleProviderBase[] { moduleProvider });
this.mMapView = new MapView(this, 256, mResourceProxy, mProvider);
Run Code Online (Sandbox Code Playgroud)
但它没有用,我想直接从网上加载MbTiles.
我知道这听起来很愚蠢,但每当我尝试使用我自己的颜色将TextTolor设置为textview时,它就永远不会这样做.
TextView tv;
tv.setTextColor(color.blue_light);
Run Code Online (Sandbox Code Playgroud)
不起作用.唯一有效的是Android自己的颜色与Color.BLUE,Color.RED属性等.
colors.xml看起来像这样:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="blue_light">#2D9DC8</color>
<color name="blue_dark">#314d61</color>
<color name="white">#FFFFFF</color>
<color name="green_light">#308A24</color>
<color name="black">#000000</color>
<color name="black_light">#333</color>
<color name="grey_light">#A1A1A1</color>
</resources>
Run Code Online (Sandbox Code Playgroud) 当我在网上下载数据时,有时它会起作用,有时它却不起作用.我的问题在于int:运行时:""
运行时是一个int,当我使用gson时,它可能会导致此问题:
01-07 21:22:57.602: E/AndroidRuntime(2726): Caused by: java.lang.NumberFormatException: Invalid int: ""
Run Code Online (Sandbox Code Playgroud)
我尝试了一些if语句,但它不起作用.
public int getRuntime() {
if(Integer.valueOf(runtime)==null){
return 0;
}else{
return runtime;
}
}
Run Code Online (Sandbox Code Playgroud)
甚至
public int getRuntime() {
if(Integer.valueOf(runtime).equals(null)){
return 0;
}else{
return runtime;
}
}
Run Code Online (Sandbox Code Playgroud)
但没有任何作用.
我正在尝试使用适用于Android的新Google Maps Utility(我需要在地图中创建群集).我正在按照本教程的每个步骤来安装库,但是一个java文件遇到了一些问题:DefaultClusterRenderer.
这是问题:我无法导入:
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
Run Code Online (Sandbox Code Playgroud)
这个'HONEYCOMB'无法解决:
Build.VERSION_CODES.HONEYCOMB;
Run Code Online (Sandbox Code Playgroud)
TimeInterpolator:
TimeInterpolator cannot be resolved to a type
Run Code Online (Sandbox Code Playgroud)
AnimeListenerAdapter:
AnimatorListenerAdapter cannot be resolved to a type
Run Code Online (Sandbox Code Playgroud)