我找到了这个Asset Studio来生成图标.它适用于启动器图标,但对于操作栏或通知图标,它不起作用.我输入了我的png文件并想生成图标,但Asset Studio只生成灰色圆圈.是否有其他工具可以生成操作栏和通知图标?

我在自定义视图的ontouch方法中需要单点触摸检测.我尝试在ACTION-DOWN和ACTION-UP中获取x和y值,在ACTION-UP中我给出了一个条件,即如果ACTIONDOWN和ACTION-UP中的X和Y值相等,则将其作为单击.
我的代码如下
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (!mSupportsZoom && !mSupportsPan) return false;
mScaleDetector.onTouchEvent(ev);
final int action = ev.getAction();
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN: {
final float x = ev.getX();
final float y = ev.getY();
mLastTouchX = x; //here i get x and y values in action down
mLastTouchY = y;
mActivePointerId = ev.getPointerId(0);
break;
}
case MotionEvent.ACTION_MOVE: {
final int pointerIndex = ev.findPointerIndex(mActivePointerId);
final float x = ev.getX(pointerIndex);
final float y = ev.getY(pointerIndex);
if (mSupportsPan && …Run Code Online (Sandbox Code Playgroud) 我想实现一个标记动画,如GIF动画.我有两个应该同时闪烁的图像.我发现在android中没有任何可以实现这一点的东西.我想做的是,创建一个每1秒运行一次的处理程序,我正在尝试为标记设置图标.但它不起作用.请指导我正确的方向.
我现在的代码如下.
Handler handler = new Handler();
Boolean marker_color_bool = true;
//adding marker and sending the marker instance to marker_animation() method where handler is called.
MarkerOptions marker = new MarkerOptions()
.title(delivery_center_name)
.snippet("This is the " + delivery_center_name + " location")
.position(location)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.red_marker));
google_map.addMarker(marker);
marker_animation(marker);
Run Code Online (Sandbox Code Playgroud)
marker_animation()方法
private final int ONE_SECONDS = 1000;
public void marker_animation(final MarkerOptions marker ) {
handler.postDelayed(new Runnable() {
public void run() {
Log.e("running",""+marker_color_bool);
if(marker_color_bool == true)
{
marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.green_marker));
marker_color_bool = false;
}
else
{
marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.red_marker));
marker_color_bool = …Run Code Online (Sandbox Code Playgroud) android google-maps google-maps-markers android-handler google-maps-android-api-2
我正在为我的应用程序使用Android原生facedetection,其中位图作为输入给出,并且应检测到面部.它适用于具有大面的位图.但不适用于小脸的位图.
我尝试了一个包含10个面的图片位图,但只检测到3个.
detectedFaces=new FaceDetector.Face[NUMBER_OF_FACES];
faceDetector=new FaceDetector(resultBmp.getWidth(),resultBmp.getHeight(),NUMBER_OF_FACES);
NUMBER_OF_FACE_DETECTED=faceDetector.findFaces(resultBmp, detectedFaces);
for(int count=0;count<NUMBER_OF_FACE_DETECTED;count++)
{
if(count==0){
face1=detectedFaces[count];
midPoint1=new PointF();
face1.getMidPoint(midPoint1);
eyeDistance=face1.eyesDistance();
left1 = midPoint1.x - (float)(1.8 * eyeDistance);
right1 = midPoint1.x + (float)(1.4 * eyeDistance);
top1 = midPoint1.y - (float)(1.4 * eyeDistance);
bottom1 = midPoint1.y + (float)(1.8 * eyeDistance);
Bitmap bmface = Bitmap.createBitmap(resultBmp, (int) left1+5, (int) top1+5, (int) (2.8 * eyeDistance)+5, (int) (3.6 * eyeDistance)+5);
}
if(count==1)
{
----
}
-------------and so-on till count==10---------
}
Run Code Online (Sandbox Code Playgroud)
现在请给我一些建议.facedetection也适用于小脸.我用的图片是
提前致谢
我创建了一个字符串的arraylist
List<String> textArray = new ArrayList<String>();
Run Code Online (Sandbox Code Playgroud)
然后我将字符串(我从edittext获取)添加到textArray,如下所示
String text = editText1.getText().toString();
textArray.add(text);
Run Code Online (Sandbox Code Playgroud)
现在我创建了一个按钮,需要在单击按钮时从数组中删除字符串.但我不知道该怎么做.我知道对于位图数组,我们使用循环清除数组中的位图,但请建议我如何从arraylist中删除或清除字符串.
根据找到用户位置的示例应用程序,监听活动中的位置更改是个好主意:
class MyActivity extends Activity implements LocationListener {
@Inject
private LocationManager locationManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
}
@Override
public void onLocationChanged(Location location) {
// do something with location
}
// ...
}
Run Code Online (Sandbox Code Playgroud)
但是,我不确定.当配置发生更改时,我的活动将被销毁并重新创建,下次将自己注册为侦听器.对旧活动的引用是在LocationManager中进行的,不是吗?
如果我提取LocationListener到单独的对象,我仍然有如何通知当前活动有关新位置的问题(不一定与请求活动相同).
有没有什么共同的模式来解决这个问题?
我有一个应用程序,我正在使用Landscape和potrait模式.我在我的每个活动中都使用了android:configChanges ="orientation | keyboardHidden".因此,当我在设备2.3上运行它时,它完全正常工作并且活动没有重新启动.但是当我在android 4.0及更高版本中打开相同的应用程序时,只要方向发生变化,活动就会重新启动.这是我的xml文件.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.iconnect.collaborator"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<supports-screens android:largeScreens="true"
android:normalScreens="true" android:smallScreens="true"
android:anyDensity="true" />
<supports-screens android:smallScreens="true" />
<supports-screens android:normalScreens="true" />
<supports-screens android:largeScreens="true" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:icon="@drawable/cnlogomini"
android:label="CollaborateNow"
android:largeHeap="true"
android:allowBackup="true"
android:theme="@style/AppTheme" >
<activity android:name="jim.h.common.android.zxinglib.CaptureActivity"
android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity android:name=".Register"
android:configChanges="orientation|keyboardHidden" ></activity>
<activity android:name=".ppllogincopy"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".Password" …Run Code Online (Sandbox Code Playgroud) android orientation screen-orientation device-orientation android-orientation
这是我的XML HorizontalScrollView
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="19" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/card_background" >
</RelativeLayout>
</LinearLayout>
</HorizontalScrollView>
Run Code Online (Sandbox Code Playgroud)
我想将RelativeLayout的宽度设置为等于HorizontalScrollView的宽度.如何使用XML(不是以编程方式)执行此操作
我ImageButton手动声明了一个数组,然后手动添加了一些数组ImageButtons,在将这些数组分配ImageButtons给XML布局后,我尝试使用for循环遍历该数组,但是我NullPointerException在迭代该数组时得到了一个(异常自带)第一次迭代它甚至没有管理迭代一次),这是我的代码:
public ImageButton Antenna, AV, Components, VGA, HDMI, Switch;
public ImageButton[] upControllingButtons = {Antenna, AV, Components, VGA, HDMI, Switch};
Antenna = (ImageButton) findViewById(R.id.antenna);
// then the other six ImageButtons
// setting the onClick for the Up_Controlling butoons
for(int k=0; k < upControllingButtons.length ; k++ ){
upControllingButtons[k].setTag("tag"); // i got the Exception here
}
Run Code Online (Sandbox Code Playgroud)
和ImageButtonXML中的:
<ImageButton
android:id="@+id/antenna"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:adjustViewBounds="true"
android:background="@drawable/remote_living_buttons"
android:clickable="true"
android:padding="8dp"
android:scaleType="centerInside"
android:src="@drawable/remote_living_antena"
android:tag="released" />
<!.. …Run Code Online (Sandbox Code Playgroud) 我为整数值创建了一个数组列表。
List<Integer> xpos = new ArrayList<Integer>();
Run Code Online (Sandbox Code Playgroud)
将整数添加到数组列表中,如下所示
int bt_x=10;
xpos.add(bt_x);
Run Code Online (Sandbox Code Playgroud)
现在如何删除单个值,即。如何从数组列表中删除一个整数。我们可以使用 arraylist.get(i).remove 删除字符串数组列表。但是如何删除整数数组列表。
android ×10
arraylist ×2
layout ×2
arrays ×1
bitmap ×1
clear ×1
crop ×1
google-maps ×1
icons ×1
imagebutton ×1
int ×1
java ×1
location ×1
memory-leaks ×1
orientation ×1
scrollview ×1
string ×1
touch ×1
xml ×1