- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我之前曾就我的 Android 应用程序中的 OutOfMemoryError 问题寻求帮助。由于我还没有解决方案,所以我需要再次请你给我一个解决方案。我在几个真实的 android 设备上测试了我的应用程序。但是在 Samsung Galaxy S3 android 4.0.4 中我有 OutOfMemoryError 问题。 Logcat 消息如下。谢谢。
07-13 10:42:23.820: E/AndroidRuntime(2065): FATAL EXCEPTION: main
07-13 10:42:23.820: E/AndroidRuntime(2065): java.lang.OutOfMemoryError
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.graphics.Bitmap.nativeCreate(Native Method)
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:618)
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:593)
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:445)
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:468)
07-13 10:42:23.820: E/AndroidRuntime(2065): at com.emin.avci.SeviyorSevmiyor.onCreate(SeviyorSevmiyor.java:75)
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.app.Activity.performCreate(Activity.java:4562)
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.app.ActivityThread.access$600(ActivityThread.java:128)
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.os.Handler.dispatchMessage(Handler.java:99)
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.os.Looper.loop(Looper.java:137)
07-13 10:42:23.820: E/AndroidRuntime(2065): at android.app.ActivityThread.main(ActivityThread.java:4514)
07-13 10:42:23.820: E/AndroidRuntime(2065): at java.lang.reflect.Method.invokeNative(Native Method)
07-13 10:42:23.820: E/AndroidRuntime(2065): at java.lang.reflect.Method.invoke(Method.java:511)
07-13 10:42:23.820: E/AndroidRuntime(2065): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
07-13 10:42:23.820: E/AndroidRuntime(2065): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
07-13 10:42:23.820: E/AndroidRuntime(2065): at dalvik.system.NativeStart.main(Native Method)
好的,这是我的应用崩溃的 Activity 的代码。
`公共(public)类 SeviyorSevmiyor 扩展 Activity 实现 OnTouchListener{
private int toastX=0,toastY=0;
private int fortuneCon;
private String toastMessage;
private String categoryName;
private ImageView activityHead;
private Vibrator shake;
private Toast toast;
private View layout;
private LayoutInflater inflater ;
private ViewGroup backgForToast;
private TextView textForToast ;
private Intent resultIntent;
private int[] leafIDs={R.id.bir,R.id.iki,R.id.uc,R.id.dort,R.id.bes,R.id.alti,R.id.yedi,
R.id.sekiz,R.id.dokuz,R.id.on,R.id.onbir,R.id.oniki,R.id.onuc,R.id.ondort,R.id.onbes,R.id.onalti,R.id.iView1};
private int[] drwbles={R.drawable.leaf_1,R.drawable.leaf_2,R.drawable.leaf_3,R.drawable.leaf_4,R.drawable.leaf_5,R.drawable.leaf_6,
R.drawable.leaf_7,R.drawable.leaf_8,R.drawable.leaf_9,R.drawable.leaf_10,R.drawable.leaf_11,R.drawable.leaf_12,R.drawable.leaf_13,R.drawable.leaf_14,
R.drawable.leaf_15,R.drawable.leaf_16,R.drawable.papatya_orta};
ImageView[] leafs=new ImageView[17];
private Button leaf11_btn1,leaf11_btn2,leaf12_btn1,leaf12_btn2,leaf13_btn1,leaf13_btn2,leaf13_btn3,leaf14_btn1,leaf14_btn2,leaf15_btn1,
leaf15_btn2,leaf16_btn1,leaf1_btn1,leaf1_btn2,leaf2_btn1,leaf2_btn2,leaf3_btn1,leaf3_btn2,leaf4_btn1,leaf4_btn2,leaf5_btn1,leaf5_btn2
,leaf6_btn1,leaf6_btn2,leaf7_btn1,leaf7_btn2,leaf8_btn1,leaf8_btn2,leaf9_btn1,leaf9_btn2,leaf10_btn1,leaf10_btn2;
private Bitmap[] bmImages=new Bitmap[17];
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.seviyor);
activityHead=(ImageView) findViewById(R.id.activityhead1);
shake = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
BitmapFactory.Options options=new BitmapFactory.Options();
for(int i=0;i<17;i++){
if(bmImages[i]!=null){
bmImages[i].recycle();
bmImages=null;
}
}
for(int i=0;i<17;i++){
bmImages[i]=BitmapFactory.decodeResource(getResources(),drwbles[i] , options);
}
initilizeToastBackground();
initilizeButtonsFor16Leafs();
initilize16Lisener();
resultIntent=new Intent(this,ResultFrame.class);
fortuneCon=16;
for(int i=0;i<17;i++){
leafs[i]=(ImageView) findViewById(leafIDs[i]);
}
for(int i=0;i<17;i++){
leafs[i].setImageBitmap(bmImages[i]);
}
Bundle frompreviousInent=getIntent().getExtras();
categoryName=frompreviousInent.getString("category");
setHeadOfActivity();
}
private void setHeadOfActivity() {
if(categoryName.equalsIgnoreCase("seviyor")){
activityHead.setImageResource(R.drawable.seviyor);
}
else if(categoryName.equalsIgnoreCase("konus")){
activityHead.setImageResource(R.drawable.konus);
}
else if(categoryName.equalsIgnoreCase("ekle")){
activityHead.setImageResource(R.drawable.ekle);
}
else{
activityHead.setImageResource(R.drawable.teklif_et);
}
}
private void initilize16Lisener() {
leaf11_btn1.setOnTouchListener(this);
leaf11_btn2.setOnTouchListener(this);
leaf12_btn1.setOnTouchListener(this);
leaf12_btn2.setOnTouchListener(this);
leaf13_btn1.setOnTouchListener(this);
leaf13_btn2.setOnTouchListener(this);
leaf13_btn3.setOnTouchListener(this);
leaf14_btn1.setOnTouchListener(this);
leaf14_btn2.setOnTouchListener(this);
leaf15_btn1.setOnTouchListener(this);
leaf15_btn2.setOnTouchListener(this);
leaf16_btn1.setOnTouchListener(this);
leaf1_btn1.setOnTouchListener(this);
leaf1_btn2.setOnTouchListener(this);
leaf2_btn1.setOnTouchListener(this);
leaf2_btn2.setOnTouchListener(this);
leaf3_btn1.setOnTouchListener(this);
leaf3_btn2.setOnTouchListener(this);
leaf4_btn1.setOnTouchListener(this);
leaf4_btn2.setOnTouchListener(this);
leaf5_btn1.setOnTouchListener(this);
leaf5_btn2.setOnTouchListener(this);
leaf6_btn1.setOnTouchListener(this);
leaf6_btn2.setOnTouchListener(this);
leaf7_btn1.setOnTouchListener(this);
leaf7_btn2.setOnTouchListener(this);
leaf8_btn1.setOnTouchListener(this);
leaf8_btn2.setOnTouchListener(this);
leaf9_btn1.setOnTouchListener(this);
leaf9_btn2.setOnTouchListener(this);
leaf10_btn1.setOnTouchListener(this);
leaf10_btn2.setOnTouchListener(this);
}
private void initilizeButtonsFor16Leafs() {
leaf11_btn1 = (Button) findViewById(R.id.leaf11_bnt1);
leaf11_btn2 = (Button) findViewById(R.id.leaf11_bnt2);
leaf12_btn1 = (Button) findViewById(R.id.leaf12_bnt1);
leaf12_btn2 = (Button) findViewById(R.id.leaf12_bnt2);
leaf13_btn1 = (Button) findViewById(R.id.leaf13_bnt1);
leaf13_btn2 = (Button) findViewById(R.id.leaf13_bnt2);
leaf13_btn3 = (Button) findViewById(R.id.leaf13_bnt3);
leaf14_btn1 = (Button) findViewById(R.id.leaf14_bnt1);
leaf14_btn2 = (Button) findViewById(R.id.leaf14_bnt2);
leaf15_btn1 = (Button) findViewById(R.id.leaf15_bnt1);
leaf15_btn2 = (Button) findViewById(R.id.leaf15_bnt2);
leaf16_btn1 = (Button) findViewById(R.id.leaf16_bnt1);
leaf1_btn1 = (Button) findViewById(R.id.leaf1_btn1);
leaf1_btn2 = (Button) findViewById(R.id.leaf1_btn2);
leaf2_btn1 = (Button) findViewById(R.id.leaf2_bnt1);
leaf2_btn2 = (Button) findViewById(R.id.leaf2_btn2);
leaf3_btn1 = (Button) findViewById(R.id.leaf3_btn1);
leaf3_btn2 = (Button) findViewById(R.id.leaf3_btn2);
leaf4_btn1 = (Button) findViewById(R.id.leaf4_btn1);
leaf4_btn2 = (Button) findViewById(R.id.leaf4_btn2);
leaf5_btn1 = (Button) findViewById(R.id.leaf5_btn1);
leaf5_btn2 = (Button) findViewById(R.id.leaf5_btn2);
leaf6_btn1 = (Button) findViewById(R.id.leaf6_btn1);
leaf6_btn2 = (Button) findViewById(R.id.leaf6_btn2);
leaf7_btn1 = (Button) findViewById(R.id.leaf7_btn1);
leaf7_btn2 = (Button) findViewById(R.id.leaf7_btn2);
leaf8_btn1 = (Button) findViewById(R.id.leaf8_btn1);
leaf8_btn2 = (Button) findViewById(R.id.leaf8_btn2);
leaf9_btn1 = (Button) findViewById(R.id.leaf9_btn1);
leaf9_btn2 = (Button) findViewById(R.id.leaf9_btn2);
leaf10_btn1 = (Button) findViewById(R.id.leaf10_btn1);
leaf10_btn2 = (Button) findViewById(R.id.leaf10_btn2);
}
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN){
toast.cancel();
this.toastX = (int) event.getRawX();
this.toastY = (int) event.getRawY();
switch (v.getId()) {
case R.id.leaf11_bnt1 :
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf11();
break;
case R.id.leaf11_bnt2:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf11();
break;
case R.id.leaf12_bnt1:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf12();
break;
case R.id.leaf12_bnt2:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf12();
break;
case R.id.leaf13_bnt1:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf13();
break;
case R.id.leaf13_bnt2:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf13();
break;
case R.id.leaf13_bnt3:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf13();
break;
case R.id.leaf14_bnt1:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf14();
break;
case R.id.leaf14_bnt2:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf14();
break;
case R.id.leaf15_bnt1:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf15();
break;
case R.id.leaf15_bnt2:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf15();
break;
case R.id.leaf16_bnt1:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf16();
break;
case R.id.leaf1_btn1:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf1();
break;
case R.id.leaf1_btn2:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf1();
break;
case R.id.leaf2_bnt1:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf2();
break;
case R.id.leaf2_btn2:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf2();
break;
case R.id.leaf3_btn1:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf3();
break;
case R.id.leaf3_btn2:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf3();
break;
case R.id.leaf4_btn1:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf4();
break;
case R.id.leaf4_btn2:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf4();
break;
case R.id.leaf5_btn1:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf5();
break;
case R.id.leaf5_btn2:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf5();
break;
case R.id.leaf6_btn1:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf6();
break;
case R.id.leaf6_btn2:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf6();
break;
case R.id.leaf7_btn1:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf7();
break;
case R.id.leaf7_btn2:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf7();
break;
case R.id.leaf8_btn1:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf8();
break;
case R.id.leaf8_btn2:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf8();
break;
case R.id.leaf9_btn1:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf9();
break;
case R.id.leaf9_btn2:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf9();
break;
case R.id.leaf10_btn1:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf10();
break;
case R.id.leaf10_btn2:
showFortuneToast(toastX,toastY);
shake.vibrate(40);
clearBtnLeaf10();
break;
default:
break;
}
}
return false;
}
private void showFortuneToast(int toastX2, int toastY2) {
/**** 决定选择哪个类别(seviyor-sevmiyor、ekle-ekleme、konus-konuşma 等..)/ 如果(categoryName.equalsIgnoreCase(“seviyor”)){ 如果(fortuneCon%2==0){ toastMessage = "Seviyor"; } 别的{ toastMessage="Sevmiyor"; } } 否则如果(categoryName.equalsIgnoreCase(“konus”)){ 如果(fortuneCon%2==0){ toastMessage="科努斯"; } 别的{ toastMessage="Konuşma"; } } else if(categoryName.equalsIgnoreCase("ekle")){ 如果(fortuneCon%2==0){ toastMessage="Ekle"; } 别的{ toastMessage="Ekleme"; } } 否则如果(categoryName.equalsIgnoreCase(“teklifet”)){ 如果(fortuneCon%2==0){ toastMessage="Teklif Et"; } 别的{ toastMessage="Teklif Etme"; }
textForToast.setText(toastMessage);
toast.setGravity(Gravity.TOP|Gravity.LEFT, toastX2-90,toastY2-90);
toast.setDuration(30);
toast.setView(layout);
toast.show();
fortuneCon--;
if(fortuneCon==0){
toast.cancel();
resultIntent.putExtra("result_cond", toastMessage);
startActivity(resultIntent);
}
}
private void initilizeToastBackground() {
inflater = getLayoutInflater();
backgForToast=(ViewGroup) findViewById(R.id.toast_layout_root);
layout = inflater.inflate(R.layout.toastbackground,backgForToast);
textForToast = (TextView) layout.findViewById(R.id.text);
toast = new Toast(getApplicationContext());
}
private void clearBtnLeaf10() {
leafs[9].setVisibility(View.GONE);
leaf10_btn1.setVisibility(View.GONE);
leaf10_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf9() {
leafs[8].setVisibility(View.GONE);
leaf9_btn1.setVisibility(View.GONE);
leaf9_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf8() {
leafs[7].setVisibility(View.GONE);
leaf8_btn1.setVisibility(View.GONE);
leaf8_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf7() {
leafs[6].setVisibility(View.GONE);
leaf7_btn1.setVisibility(View.GONE);
leaf7_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf6() {
leafs[5].setVisibility(View.GONE);
leaf6_btn1.setVisibility(View.GONE);
leaf6_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf5() {
leafs[4].setVisibility(View.GONE);
leaf5_btn1.setVisibility(View.GONE);
leaf5_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf4() {
leafs[3].setVisibility(View.GONE);
leaf4_btn1.setVisibility(View.GONE);
leaf4_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf3() {
leafs[2].setVisibility(View.GONE);
leaf3_btn1.setVisibility(View.GONE);
leaf3_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf2() {
leafs[1].setVisibility(View.GONE);
leaf2_btn1.setVisibility(View.GONE);
leaf2_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf1() {
leafs[0].setVisibility(View.GONE);
leaf1_btn1.setVisibility(View.GONE);
leaf1_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf16() {
leafs[15].setVisibility(View.GONE);
leaf16_btn1.setVisibility(View.GONE);
}
private void clearBtnLeaf15() {
leafs[14].setVisibility(View.GONE);
leaf15_btn1.setVisibility(View.GONE);
leaf15_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf14() {
leafs[13].setVisibility(View.GONE);
leaf14_btn1.setVisibility(View.GONE);
leaf14_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf13() {
leafs[12].setVisibility(View.GONE);
leaf13_btn3.setVisibility(View.GONE);
leaf13_btn1.setVisibility(View.GONE);
leaf13_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf12() {
leafs[11].setVisibility(View.GONE);
leaf12_btn1.setVisibility(View.GONE);
leaf12_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf11() {
leafs[10].setVisibility(View.GONE);
leaf11_btn1.setVisibility(View.GONE);
leaf11_btn2.setVisibility(View.GONE);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
Intent menuReturn=new Intent(this,MenuFrame.class);
startActivity(menuReturn);
}
return super.onKeyDown(keyCode, event);
}
编辑:Android 版本 4.0.4 而不是 4.1`
最佳答案
使用下面的方法来缩小图像的大小。由于图像尺寸过大,您收到 OutOfMemory 错误。
public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId,
int reqWidth, int reqHeight) {
// First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(res, resId, options);
// Calculate inSampleSize
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
return BitmapFactory.decodeResource(res, resId, options);
}
public static int calculateInSampleSize(
BitmapFactory.Options options, int reqWidth, int reqHeight) {
// Raw height and width of image
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
if (width > height) {
inSampleSize = Math.round((float)height / (float)reqHeight);
} else {
inSampleSize = Math.round((float)width / (float)reqWidth);
}
}
return inSampleSize;
}
并在您的代码中使用
mImageView.setImageBitmap(
decodeSampledBitmapFromResource(getResources(), R.id.myimage, 100, 100));
更多详情,建议您必读developer Android 开发者网站提供的有关位图效率的信息。
关于android - Android应用程序中的OutOfMemoryError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11466300/
我最近在/ drawable中添加了一些.gifs,以便可以将它们与按钮一起使用。这个工作正常(没有错误)。现在,当我重建/运行我的应用程序时,出现以下错误: Error: Gradle: Execu
Android 中有返回内部存储数据路径的方法吗? 我有 2 部 Android 智能手机(Samsung s2 和 s7 edge),我在其中安装了一个应用程序。我想使用位于这条路径中的 sqlit
这个问题在这里已经有了答案: What's the difference between "?android:" and "@android:" in an android layout xml f
我只想知道 android 开发手机、android 普通手机和 android root 手机之间的实际区别。 我们不能从实体店或除 android marketplace 以外的其他地方购买开发手
自Gradle更新以来,我正在努力使这个项目达到标准。这是一个团队项目,它使用的是android-apt插件。我已经进行了必要的语法更改(编译->实现和apt->注释处理器),但是编译器仍在告诉我存在
我是android和kotlin的新手,所以请原谅要解决的一个非常简单的问题! 我已经使用导航体系结构组件创建了一个基本应用程序,使用了底部的导航栏和三个导航选项。每个导航选项都指向一个专用片段,该片
我目前正在使用 Facebook official SDK for Android . 我现在正在使用高级示例应用程序,但我不知道如何让它获取应用程序墙/流/状态而不是登录的用户。 这可能吗?在那种情
我在下载文件时遇到问题, 我可以在模拟器中下载文件,但无法在手机上使用。我已经定义了上网和写入 SD 卡的权限。 我在服务器上有一个 doc 文件,如果用户单击下载。它下载文件。这在模拟器中工作正常但
这个问题在这里已经有了答案: What is the difference between gravity and layout_gravity in Android? (22 个答案) 关闭 9
任何人都可以告诉我什么是 android 缓存和应用程序缓存,因为当我们谈论缓存清理应用程序时,它的作用是,缓存清理概念是清理应用程序缓存还是像内存管理一样主存储、RAM、缓存是不同的并且据我所知,缓
假设应用程序 Foo 和 Eggs 在同一台 Android 设备上。任一应用程序都可以获取设备上所有应用程序的列表。一个应用程序是否有可能知道另一个应用程序是否已经运行以及运行了多长时间? 最佳答案
我有点困惑,我只看到了从 android 到 pc 或者从 android 到 pc 的例子。我需要制作一个从两部手机 (android) 连接的 android 应用程序进行视频聊天。我在想,我知道
用于使用 Android 以编程方式锁定屏幕。我从 Stackoverflow 之前关于此的问题中得到了一些好主意,并且我做得很好,但是当我运行该代码时,没有异常和错误。而且,屏幕没有锁定。请在这段代
文档说: android:layout_alignParentStart If true, makes the start edge of this view match the start edge
我不知道这两个属性和高度之间的区别。 以一个TextView为例,如果我将它的layout_width设置为wrap_content,并将它的width设置为50 dip,会发生什么情况? 最佳答案
这两个属性有什么关系?如果我有 android:noHistory="true",那么有 android:finishOnTaskLaunch="true" 有什么意义吗? 最佳答案 假设您的应用中有
我是新手,正在尝试理解以下 XML 代码: 查看 developer.android.com 上的文档,它说“starStyle”是 R.attr 中的常量, public static final
在下面的代码中,为什么当我设置时单选按钮的外观会发生变化 android:layout_width="fill_parent" 和 android:width="fill_parent" 我说的是
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 9
假设我有一个函数 fun myFunction(name:String, email:String){},当我调用这个函数时 myFunction('Ali', 'ali@test.com ') 如何
我是一名优秀的程序员,十分优秀!