posted @ 2011-12-19 00:03 allin.android 阅读(127) 评论(0) 编辑

最近在某电子市场提交了一个应用《美女App》,结果被下架了,

理由是:“您好,请你修改您程序中不和谐的图片重新提交,感谢您对XX市场的支持和理解~~谢谢合作!”

与客服沟通后得出的结论是,应用中的美女图片不能“露沟”,表情不能“淫荡”...

无语....

又没有漏点,只是比较清凉而已,淫不淫荡也得见仁见智吧~

可以下来看看是不是不和谐

http://static.yingyonghui.com/apk/181141/org.allin.app.grilPhoto.1321850350751.apk

 

 

 

posted @ 2011-11-22 22:48 allin.android 阅读(780) 评论(5) 编辑
摘要: onInterceptTouchEvent()是ViewGroup的一个方法,目的是在系统向该ViewGroup及其各个childView触发onTouchEvent()之前对相关事件进行一次拦截,Android这么设计的想法也很好理解,由于ViewGroup会包含若干childView,因此需要能够统一监控各种touch事件的机会,因此纯粹的不能包含子view的控件是没有这个方法的,如LinearLayout就有,TextView就没有。 onInterceptTouchEvent()使用也很简单,如果在ViewGroup里覆写了该方法,那么就可以对各种touch事件加以拦截。但是如何拦截,是否所有的touch事件都需要拦截则是比较复杂的,touch事件在onInterceptTouchEvent()和onTouchEvent以及各个childView间的传递机制完全取决于onInterceptTouchEvent()和onTouchEvent()的返回值。并且,针对down事件处理的返回值直接影响到后续move和up事件的接收和传递。阅读全文
posted @ 2011-08-24 15:25 allin.android 阅读(356) 评论(0) 编辑
摘要: 针对屏幕上的一个View控件,Android如何区分应当触发onTouchEvent,还是onClick,亦或是onLongClick事件? 在Android中,一次用户操作可以被不同的View按次序分别处理,并将完全响应了用户一次UI操作称之为消费了该事件(consume),那么Android是按什么次序将事件传递的呢?又在什么情况下判定为消费了该事件? 搞清楚这些问题对于编写出能正确响应UI操作的代码是很重要的,尤其当屏幕上的不同View需要针对此次UI操作做出各种不同响应的时候更是如此,一个典型例子就是用户在桌面上放置了一个Widget,那么当用户针对widget做各种操作时,桌面本身有的时候要对用户的操作做出响应,有时忽略。只有搞清楚事件触发和传递的机制才有可能保证在界面布局非常复杂的情况下,UI控件仍然能正确响应用户操作。阅读全文
posted @ 2011-08-24 15:23 allin.android 阅读(1007) 评论(0) 编辑

直接使用ImageView显示bitmap会占用较多资源,特别是图片较大的时候,可能导致崩溃。

使用BitmapFactory.Options设置inSampleSize, 这样做可以减少对系统资源的要求。

属性值inSampleSize表示缩略图大小为原始图片大小的几分之一,即如果这个值为2,则取出的缩略图的宽和高都是原始图片的1/2,图片大小就为原始大小的1/4。

Options中有个属性inJustDecodeBounds,SDK中是这么说的

If set to true, the decoder will return null (no bitmap), but the out... fields will still be set, allowing the caller to query the bitmap without having to allocate the memory for its pixels.

通过设置inJustDecodeBounds为true,获取到outHeight(图片原始高度)和outWidth(图片的原始宽度),然后计算一个inSampleSize(缩放值)


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"
>
<TextView
android:layout_width="fill_parent"
android:layout_height
="wrap_content"
android:text
="@string/hello"
/>
<ImageView
android:id="@+id/imageview"
android:layout_gravity
="center"
android:layout_width
="fill_parent"
android:layout_height
="fill_parent"
android:scaleType
="center"
/>
</LinearLayout>

java源码

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.Toast;

public class AndroidImage extends Activity {

private String imageFile = "/sdcard/AndroidSharedPreferencesEditor.png";
/** Called when the activity is first created. */

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

ImageView myImageView
= (ImageView)findViewById(R.id.imageview);
//Bitmap bitmap = BitmapFactory.decodeFile(imageFile);
//myImageView.setImageBitmap(bitmap);

Bitmap bitmap;
float imagew = 300;
float imageh = 300;

BitmapFactory.Options bitmapFactoryOptions
= new BitmapFactory.Options();
bitmapFactoryOptions.inJustDecodeBounds
= true;
bitmap
= BitmapFactory.decodeFile(imageFile, bitmapFactoryOptions);

int yRatio = (int)Math.ceil(bitmapFactoryOptions.outHeight/imageh);
int xRatio = (int)Math.ceil(bitmapFactoryOptions.outWidth/imagew);

if (yRatio > 1 || xRatio > 1){
if (yRatio > xRatio) {
bitmapFactoryOptions.inSampleSize
= yRatio;
Toast.makeText(
this,
"yRatio = " + String.valueOf(yRatio),
Toast.LENGTH_LONG).show();
}
else {
bitmapFactoryOptions.inSampleSize
= xRatio;
Toast.makeText(
this,
"xRatio = " + String.valueOf(xRatio),
Toast.LENGTH_LONG).show();
}
}
else{
Toast.makeText(
this,
"inSampleSize = 1",
Toast.LENGTH_LONG).show();
}

bitmapFactoryOptions.inJustDecodeBounds
= false;
bitmap
= BitmapFactory.decodeFile(imageFile, bitmapFactoryOptions);
myImageView.setImageBitmap(bitmap);
}

}

  

posted @ 2011-08-08 23:45 allin.android 阅读(1357) 评论(0) 编辑

查看最新足球赛事预告, 定制比赛提醒任务, 及时更新关注球赛比分, 掌握最新的体育资讯, 是球迷必备的工具

下载地址:

二维码

posted @ 2011-08-03 11:23 allin.android 阅读(115) 评论(0) 编辑
摘要: 茶的香味,她会帮你记住。茶的故事,她会说给你听。茶的资讯,她会与你分享。如果你喜欢茶,就拥有她吧。下载:阅读全文
posted @ 2011-05-17 11:12 allin.android 阅读(327) 评论(2) 编辑
摘要: 印有 Android 形象的体恤衫应该会深受 Android 迷们的大爱吧?而且现在正进入炎热的夏季,这样的体恤衫不仅穿着舒服凉爽而且还非常酷。看看这些图案吧,各种各样应有尽有,而且甚至于 Android 机器人还被 Hello Kitty 了…各种各样甚至是你前所未闻的。有兴趣的读者可以到RedBubble网站看看,23.94 刀(大约 155 元天朝币)就可以搞到一件这样的体恤衫(另外动手能力强的话貌似可以下载该网站上的图案将其矢量化,然后放大了自己印去…山寨一件貌似也不错)阅读全文
posted @ 2011-05-10 13:43 allin.android 阅读(391) 评论(1) 编辑
摘要: 这段时间一直在学习andenginer,并开发了一款塔防游戏《android防御战》,算是能学以致用 :) 下面是对游戏的介绍,有兴趣的朋友可以下来玩玩看阅读全文
posted @ 2011-04-29 21:51 allin.android 阅读(702) 评论(3) 编辑
摘要: TextView tv=(TextView)findViewById(R.id.tv); DisplayMetrics dm=new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); float width=dm.widthPixels*dm.density; float height=dm.heightPixels*dm.density; tv.setText(width+"X"+height);其中dm.withPixels和dm.heightPixels得到的宽度和高度值都阅读全文
posted @ 2011-03-17 21:56 allin.android 阅读(643) 评论(0) 编辑