小编kan*_*pan的帖子

如何更改简单列表项的文本颜色

我有一个ListActivity,我正在显示一个列表:

setListAdapter(new ArrayAdapter<String>(getApplicationContext(),
                android.R.layout.simple_list_item_single_choice, mStringList));
Run Code Online (Sandbox Code Playgroud)

默认情况下,列表项的文本颜色为白色,我想将列表中文本视图的文本颜色更改为黑色.

我该怎么办?

android listview

42
推荐指数
4
解决办法
10万
查看次数

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

Android两款游戏将在互联网上播放

我在android中开发了一个简单的双人棋牌游戏,可以使用蓝牙进行游戏.我希望通过互联网播放来扩展它.每当玩家进行移动时,移动应通过互联网传输给其他玩家.

如何使这成为可能?

我听说过C2DM机制.它是否适用于我描述的场景并且可靠吗?

谢谢:)

android android-c2dm

13
推荐指数
3
解决办法
3478
查看次数

如何定期运行服务方法?

我有一个Android服务正在运行,但我想每X小时执行一次特定的服务方法来更新数据.在不浪费android资源的情况下,最好的方法是什么?

android android-service

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

ListView不会触发setOnLongClickListener,只会触发setOnItemClickListener

我希望在listView上有两种类型的点击 - onClick和LongClick.

我已经实现了这样:

this.listViewSub = (ListView) this.findViewById(R.id.listsub);

this.listViewSub.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(final AdapterView parent, final View view, final int position,
                final long id) { ... }    });

        // listen to long click - to share texts
    this.listViewSub.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) { ... } });
Run Code Online (Sandbox Code Playgroud)

但它并没有解雇Long Click.任何人都知道为什么?

android listview android-listview onlongclicklistener

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

Android:ListView中的页脚

我有一个listview如下

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:orientation="horizontal"
    android:background="#E6E7E2">
    <ImageView android:id="@+id/Thumbnail" android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:src="@drawable/icon" />
    <TextView android:id="@+id/FilePath" android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:textColor="#E6E7E2"
        />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我的页脚如下

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="match_parent" android:layout_gravity="bottom">
    <LinearLayout android:layout_width="fill_parent" 
            android:layout_alignParentBottom="true" 
            android:layout_height="wrap_content"
            android:id="@+id/layoutfooterbutton" android:layout_gravity="bottom">

            <Button android:layout_weight=".30" android:layout_margin="2dp"
                android:layout_height="60dp" android:layout_width="100dp"
                android:textColor="#FFF" android:gravity="bottom|center"
                android:textSize="12dp" android:id="@+id/ButtonAudio" android:background="@drawable/vid_red"/>

            <Button android:layout_weight=".30" android:layout_height="60dp" android:layout_width="100dp"
                android:gravity="bottom|center" android:background="@drawable/redblank"
                android:textColor="#E6E7E2" android:id="@+id/ButtonBrowse" android:layout_marginTop="2dp"/>
            <Button android:layout_weight=".30" android:layout_margin="2dp"
                android:layout_height="60dp" android:layout_width="100dp"
                android:textColor="#FFF" android:gravity="bottom|center"
                android:textSize="12dp" android:background="@drawable/reddelete" android:id="@+id/ButtonDelete"/>

        </LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

当我使用时将页脚添加到列表视图

View header = getLayoutInflater().inflate(R.layout.header, null);
View footer = getLayoutInflater().inflate(R.layout.footer, …
Run Code Online (Sandbox Code Playgroud)

xml android listview footer android-layout

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

Android:TelephonyManager.getSimSerialNumber() 返回 null

在什么情况下该方法返回空引用?只能靠sim卡吗?在这些情况下,不存在检索后者的标识号的替代方法吗?

谢谢大家!

android telephony telephonymanager

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

如何通过Android应用程序编辑日历事件

如何通过Android应用程序编辑日历中的日历事件..

任何人都知道如何在日历应用程序中打开议程活动.....

android calendar

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

Android:启动画面没有显示,为什么?

我正在学习Android.从我到目前为止阅读的文档中我无法弄清楚如何使用show view来显示(在睡眠期间屏幕保持空白).看来我需要为主布局开始一个新的活动,但这看起来很浪费(飞溅应该永远消失,我想重用它的线程).

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class Ext3 extends Activity {

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);

        Log.v("Ext3", "starting to sleep");

        try {
            Thread.sleep (5000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        Log.v("Ext3", "done sleeping");

        setContentView (R.layout.main);
    }

}
Run Code Online (Sandbox Code Playgroud)

android splash-screen

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

Android屏幕共享

是否可以将屏幕从一个Android设备共享到另一个设备,类似于在桌面上进行设置的方式.我知道这可能涉及生根设备.

android screen

5
推荐指数
0
解决办法
3270
查看次数