小编Yon*_*lan的帖子

Android 2.3.3列表视图页脚背景

这个很奇怪.我有一个列表视图,它是相对布局的一部分.我已为此相对布局设置了背景,并使列表视图背景变为透明.

现在,一切都很好,直到今天早上.即使我的列表视图中只有一行,我也可以看到整个屏幕都覆盖了我的自定义背景.

然后,我获得了Verizon Motorola Droid X for 2.3.3的更新(之前为2.2).一旦更新,我再次启动我的应用程序,现在发生了什么.

如果我的列表视图只有一行,我看到它下面有一个白色区域而不是我的自定义背景.但如果它说100行并因此覆盖整个屏幕我将不会看到奇怪的白色背景.我的相对布局的宽度和高度设置为"fill_parent".

我在底部发布了我的XML.有没有其他人遇到过这个问题,或者我犯了一些非常愚蠢的错误.

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:background = "@drawable/background" 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <ListView   android:id = "@+id/listQueue"
                android:layout_width = "fill_parent"
                android:layout_height = "fill_parent"
                android:layout_below = "@id/homeScreenBanner"
                android:background="@android:color/transparent"
                android:divider="@drawable/separator"
                android:scrollingCache="false"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

编辑:

我想我找到了解决这个问题的方法:

将layout_height属性更改为wrap_content,它就像一个魅力.:)

更改后的行. android:layout_height = "wrap_content"

android android-widget android-layout android-listview

22
推荐指数
2
解决办法
6182
查看次数

适用于HTC Incredible的HTTP MP3流的Android Intent

在股票Droid和Nexus One上,这样的意图:

new Intent(Intent.ACTION_VIEW).setDataAndType(Uri.parse("http://example.com/somemp3.mp3"), "audio/mp3");
Run Code Online (Sandbox Code Playgroud)

工作正常并弹出系统音乐播放器以流式传输文件.但是它与HTC Incredible上的任何活动都不匹配,当我调用startActivity它时会导致强制关闭(我猜测是因为在SenseUI的替换应用程序中缺少意图过滤器).如果我不需要,我不想自己管理MediaPlayer实例; 有没有人知道是否有办法构建一个Intent来说服Incredible在其内置音乐或流媒体应用程序中通过HTTP播放MP3流?

android android-intent

9
推荐指数
1
解决办法
2520
查看次数

activity not found to handle intent

I have a problem regarding my intent. It seems that my app crashes when i select the intent. I found the line of error code due to the stack trace. But i couldn't find anything wrong with it. Hope anyone can help me with this.

This is the java code in line 121:
startActivity(new Intent(Intent.ACTION_INSERT, getIntent().getData()));

This is the stack trace:

11-24 16:09:24.634: ERROR/AndroidRuntime(222): Uncaught handler: thread main exiting due to uncaught exception
11-24 16:09:24.834: ERROR/AndroidRuntime(222): android.content.ActivityNotFoundException: No Activity found …
Run Code Online (Sandbox Code Playgroud)

android

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

Android:最小化应用程序和显示图标

问候,

我几乎已经完成了我的Android应用程序的开发,但是我希望能够为用户提供在后台最小化运行它的选项,并在发生某些事件时收到警报.

但是,我真的不知道从哪里开始.我试图在状态栏上显示一个图标,但无济于事.基本上我喜欢类似于"Trapster"应用程序的功能,其中会出现一个小图标,当你接近高速摄像机时应用程序会通知你!

这是我的代码:

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.widget.Toast;

public class Background extends Service{

    @Override
    public IBinder onBind(Intent arg0) {
        // TODO Auto-generated method stub
        return null;
    }
    @Override
    public void onCreate() {
          super.onCreate();
          Toast.makeText(this,"Service created ...", Toast.LENGTH_LONG).show();
    }

    @Override
    public void onDestroy() {
          super.onDestroy();
          Toast.makeText(this, "Service destroyed ...", Toast.LENGTH_LONG).show();
    }
}
Run Code Online (Sandbox Code Playgroud)

此外,是否有必要设置一些使用服务的权限?这是我在清单文件中的内容:

<uses-permission
    android:name="android.permission.ACCESS_BACKGROUND_SERVICE" />
Run Code Online (Sandbox Code Playgroud)

java service android background

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