小编Dix*_*tel的帖子

android webview setdefaultfontsize(int size),大小单位是多少?

android webview

webview.setdefaultfontsize(int size);
Run Code Online (Sandbox Code Playgroud)

什么是大小单位?

webview.getSettings().setDefaultFontSize(20);
Run Code Online (Sandbox Code Playgroud)

它是20pt20dp或其他uinit?

android font-size webview

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

在java中静态块之前或之后声明静态变量之间的区别

代码1:

       public class StaticBlockExample1
      {
        static {  value = 20;  }

        static int value = 10;
        public static void main(String[] args) {

              System.out.println(" Value = " + value);
        }
    }
Run Code Online (Sandbox Code Playgroud)

StaticBlockExample1的输出为10

代码2:

  public class StaticBlockExample2 
      {
        static int value = 10;
        static {    value = 20;     }   

        public static void main(String[] args)
           {
            System.out.println(" Value = " + value);
           }
      }
Run Code Online (Sandbox Code Playgroud)

StaticBlockExample2的输出为20.

与上述例子的输出相混淆.在静态块之前或之后声明静态变量有什么意义吗?

java

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

Google Maps v2使用setMyLocationEnabled时出错

我不知道是我出了问题,得到一个nullPointerException使用googlemap.setMyLocationEnabled(true)在谷歌地图V2例子.

MainActivity.java文件:

package com.example.locationgooglemapsv2;
import java.io.IOException;
import java.util.List;

import android.content.Context;
import android.location.Address;
import android.location.Criteria;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnMapClickListener;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

public class MainActivity extends FragmentActivity implements LocationListener {

GoogleMap googleMap;
MarkerOptions markerOptions;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Getting reference to the SupportMapFragment of activity_main.xml
    SupportMapFragment fm …
Run Code Online (Sandbox Code Playgroud)

android android-maps android-mapview android-maps-v2

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

我们如何定义动态(抛物线曲线)ViewObject的路径(Bitmap)

我目前正致力于One 2D Android游戏,

在这个游戏中,一个ViewObject(位图)抛物线路径上移动屏幕就像在这个图像中一样,但是这个路径是静态的,静态路径在画布上绘制了Fingure,

与签名图相同.

在此输入图像描述

位图移动代码在此静态路径上

//animation step
private static int iMaxAnimationStep = 900;
private int iCurStep = 0;
private Path ptCurve = new Path(); //curve
private PathMeasure pm;            //curve measure
private float fSegmentLen;         //curve segment length


 //init smooth curve
    PointF point = aPoints.get(0);
    ptCurve.moveTo(point.x, point.y);

    for(int i = 0; i < aPoints.size() - 1; i++){
        point = aPoints.get(i);
        PointF next = aPoints.get(i+1);
  ptCurve.quadTo(point.x, point.y, (next.x + point.x) / 2, (point.y + next.y) / 2); …
Run Code Online (Sandbox Code Playgroud)

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