小编Swa*_*yam的帖子

在可扩展ListView Android中更改单击子项的背景颜色

我想更改在ExpandableListView中单击的子项的背景颜色.也就是说,当点击任何孩子时,它的背景颜色应该被改变.我试图以这种方式去它,但它选择了一些其他行,而不是已被点击的那一行.

public boolean onChildClick(ExpandableListView parent, View v,
        int groupPosition, int childPosition, long id) {

    parent.getChildAt(childPosition).setBackgroundColor(Color.DKGRAY);

    return false;
}
Run Code Online (Sandbox Code Playgroud)

请告诉我可能缺少的东西.

android background-color expandablelistview

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

Android自定义GridLayout与文本+图像

在我的应用程序中,我试图从Web服务获取一组用户的详细信息.然后,我想在GridLayout中显示每个用户的图像及其名称.我以前没有使用过GridLayout,因此试图通过在线提供的教程,但大多数只处理图像.我需要在网格中显示图像和文本.

如何设置自定义GridLayout以显示文本和图像?

android grid-layout

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

带有背景颜色的 Android 按钮图标

我想创建一个这样的按钮

我想在按钮的中心添加一个图像(用户图像)并保持按钮的背景颜色(灰色)。

我尝试将背景属性与填充一起使用,但似乎没有效果。

任何人都可以指导我怎么做吗?

我应该在我的 xml 中使用drawableTop等属性???

请帮忙。

android image button

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

SVN checkout和Subclipse都不起作用

我对这个svn的概念非常陌生,因此对你来说这听起来可能是一个微不足道的问题.但我真的需要帮助,因为即使在网上搜索了一个多小时后我也找不到出路.

我想获得这个项目的源代码.

正如您在" 浏览"部分中看到的,所有源代码都可用.

我安装了tortoiseSVN并通过右键单击该文件夹使用了SVN Checkout选项.

但是我在tortoiseSVN中得到了这个错误:

Command: Checkout from http://android-launcher-plus.googlecode.com/svn/trunk/android-launcher-plus-read-only, revision HEAD, Fully recursive, Externals included  
Error: URL  
Error:  'http://android-launcher-plus.googlecode.com/svn/trunk/android-launcher-plus-read-only'  
Error:  doesn't exist  
Completed!
Run Code Online (Sandbox Code Playgroud)

我甚至安装了subclipse并尝试通过签出来在eclipse中导入项目但是我得到了同样的错误.

有没有其他方法从我提到的网站获取代码?(问题是我需要为andorid制作一个启动器应用程序,如果我能以某种方式得到这些代码,它真的会非常有帮助)

提前致谢!

subclipse svn tortoisesvn

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

启动BlackBerry应用程序开发

我是一名移动应用程序开发人员,在Windows Phone应用程序开发和Android方面拥有相当不错的经验.现在,我想开始为Blackberry开发.

通过官方的黑莓网站,我发现可以使用各种Runtime for Android应用工具将我现有的Android应用程序移植到Blackberry 10和BlackBerry Playbook .

我的问题:什么是更好的?我应该使用标准的Blackberry Java SDK为Blackberry开发应用程序,还是可以在Android上制作我的应用程序,然后将它们重新打包用于BlackBerry-10和BlackBerry Playbook?我知道有些Android应用程序可能与BlackBerry不兼容,例如依赖Google Maps或Android的文字转语音引擎的pacakges,但是现在我不打算在我的应用程序中使用它们黑莓.

鉴于我在编程方面的知识,我想我有三个选择:

  1. 使用C/C++ NDK构建
  2. 在Android上构建应用程序,然后在BlackBerry重新打包它们
  3. 使用BlackBerry Java(移动版)构建

哪个是最优选的,方便的?

我对Android非常熟悉,但对J2ME一无所知.因此,我认为不是学习在J2ME中绕过UI,而是在Android中进行,并为Blackberry重新打包.这是正确的做法吗?

android blackberry java-me blackberry-playbook blackberry-10

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

裁剪图像而不创建新文件

我有这段代码从图库中获取图像,然后将其传递给意图进行裁剪.一切工作正常,但这个无论是在画廊创造了新的裁剪图像或裁剪一个替换旧的形象,但我想要做的就是让新的裁剪后的图像在我的节目临时存储,直到它再次被用户更改.

这是我的代码:

Uri selectedImage = imageReturnedIntent.getData();

final Intent intent = new Intent("com.android.camera.action.CROP");
                intent.setData(selectedImage);
                intent.putExtra("outputX", width);
                intent.putExtra("outputY", height);
                intent.putExtra("aspectX", width);
                intent.putExtra("aspectY", height);
                intent.putExtra("scale", true);
                intent.putExtra("noFaceDetection", true);
                intent.putExtra("output", selectedImage); // with this enabled it replaces the original image and without it creates new one in gallery.
                startActivityForResult(intent, 23);
Run Code Online (Sandbox Code Playgroud)

android crop bitmap android-intent

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

Android 2.3中的NavigationDrawer选择问题

这是我的NavigationDrawer列表项的定义方式.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    style="?android:attr/spinnerDropDownItemStyle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" 
    android:padding="15dp">

    <ImageView
        android:id="@+id/drawer_list_item_icon"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:adjustViewBounds="true" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="center_vertical|left"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/drawer_list_item_title"
            style="?android:attr/spinnerDropDownItemStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ellipsize="end"
            android:textColor="#00FFFF"
            android:singleLine="true" />

        <TextView
            android:id="@+id/drawer_list_item_subtitle"
            style="?android:attr/spinnerDropDownItemStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ellipsize="end"
            android:singleLine="true"
            android:textAppearance="?android:attr/textAppearanceSmall" />
    </LinearLayout>

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

我正在使用ActionBarSherlock库和SherlockNavigationDrawer.

一切都在我的Android 4.3设备中完美运行.

但在我的2.3.3设备中,我遇到了一个奇怪的问题.

这是初始NavigationDrawer的外观.

在此输入图像描述

问题场景:我按住任何listItem,然后向上或向下拖动我的手指(同时仍然按住)向另一个listItem.

就是这种情况发生的时候.

在此输入图像描述

所有listItem都以白色突出显示,直到并且除非以正常方式单击另一个listItem(即使我关闭并重新打开NavDrawer,仍然整个列表仍然以白色突出显示).

但这不会发生在Android 4.3中.

它只发生在Android 2.3.3中(可能发生在所有前ICS设备上).

这是兼容性库的问题吗?

这是我在values-v11文件夹中唯一的附加代码,因为Android 2.3中没有"activatedBackgroundIndicator".

<resources>
    <style name="listViewActivatedStyle">
        <item name="android:background">?android:attr/activatedBackgroundIndicator</item>
    </style>
</resources>
Run Code Online (Sandbox Code Playgroud)

Android 2.3无法访问上述代码.这是它给出这个问题的原因吗?或者兼容性库中存在错误?

任何建议都将深表感谢.

android actionbarsherlock navigation-drawer

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

禁用后退主页按钮Android 3.1

我有一个运行在Samsung Galaxy Tab 8.9和Android 3.1上的应用程序.

我必须禁用后退按钮.我知道

<category android:name="android.intent.category.HOME" />

禁用"主页"按钮.但我不想禁用主页按钮.我想禁用BackButton而不是HomeButton.

感谢大家..

android back-button android-3.1-honeycomb

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