小编Akh*_*ain的帖子

Widget中的图像

我正在尝试在onUpdate中的窗口小部件布局中的图像视图中设置图像,但图像未更新

 @Override
     public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) 
     {
         Log.i(TAG, "onUpdate called");
         for (int appWidgetId : appWidgetIds) 
         {
             Bitmap bitmap=ImageUtils.getBitmap(context, appWidgetId);
             RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.widget);

             remoteView.setImageViewBitmap(R.id.imgView,bitmap);
             appWidgetManager.updateAppWidget(appWidgetId, remoteView);
         }
     }
Run Code Online (Sandbox Code Playgroud)

小部件的xml布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/imgView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:src="@drawable/ic_launcher" />

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

清单文件

<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.demo.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
         <activity
             android:name=".WidgetConfig"
             android:label="@string/app_name" >
             <intent-filter>
                  <action
                    android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
             </intent-filter>
         </activity>
        <receiver
            android:name="BasicWidgetProvider"> …
Run Code Online (Sandbox Code Playgroud)

android android-widget remoteview appwidgetprovider android-appwidget

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

Rails 3- Active Admin(Formtastic),设置列宽

我正在自定义管理中的索引表单.我有一些列,如:

column :id
column :name 
Run Code Online (Sandbox Code Playgroud)

我想设置这些列的宽度.有一个简单的方法吗?

ruby formtastic ruby-on-rails-3 ruby-on-rails-3.1 activeadmin

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

找不到Availability.h,UIKit.h等

我在这里遇到了很大的问题.

我最近从Mac App Store下载了Xcode 4.3,因为它具有Lion的全屏功能.然后,我的项目停止编译.它说:

Availability.h未找到词法或预处理器问题文件.

//
// Prefix header for all source files of the 'TRGame' target in the 'TRGame' project
//

#import <Availability.h>

#ifndef __IPHONE_3_0
#warning "This project uses features only available in iPhone SDK 3.0 and later."
#endif


#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
#endif
Run Code Online (Sandbox Code Playgroud)

那是在xxxx-Prefix.pch文件中.

如果我发表评论#import Availability.h,它会告诉我它找不到UIKit.h,依此类推......

帮助将非常感谢!

iphone import xcode objective-c

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

Java多变量长度参数

在处理变长参数之前,我还没有看到今天之前的特定事情

例如,有一个名为prepared statement的方法,带有声明

1.

  String prepareStatement(String... columnNames,String... values) 
//String... columnNames(Eclipse shows error saying The variable argument type String of the method prepareStatement must be the last parameter)
Run Code Online (Sandbox Code Playgroud)

2.另一种方法声明

  String prepareStatement(int i,String... columnNames,String... values)
  //still the same result as above(The variable ...... parameter)
Run Code Online (Sandbox Code Playgroud)

为什么java不允许多个变量长度参数?还有其他方法可以实现吗?

PS:这样做的原因是我的要求是为传递的参数生成通用的预准备语句,因为所有这些参数都将通过属性传递

java methods android variadic-functions method-declaration

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

如何删除Jenkins/Hudson矩阵构建中无用的未配置项

我使用Jenkins配置我的多配置构建,就像一个快照.

我使用的轴是:

  • 标签:Mac10.6,Mac10.7Windows
  • 平台:Mac10.6,Mac10.7,WinXP,Win7WinServer2008
  • 任务:_App_Installer_,ATS

很明显,WinXPMac10.6标签上构建是没有意义的.虽然它显示为已禁用/未配置,但仍会让人感到困惑.

那么有什么办法可以删除无用的配置吗?

hudson hudson-plugins jenkins jenkins-plugins

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

詹金斯的工作失踪了

我有一个跨越45个奴隶的大量并行化构建(一个刚刚处理启动的主人).

我遇到的问题是约有3%的工作消失了.

项目设置是一个"主"工作,然后通过N个从属启动(通过参数化作业插件)N个作业.大多数情况下,主作业的控制台输出对于分布式构建步骤的作业编号是正确的.

然而,偶尔,控制台中指示的作业实际上属于完全不同的构建.

我甚至在哪里开始寻找追踪它?jenkins日志几乎没有任何关于失败的工作或启动工作的问题的信息.

我现在最好的猜测是,当发生某些事情时,丢失的工作实际上已经排队等待执行者.但我没有证据支持这一点.

思想,建议,有用的链接都非常感谢,

master-slave jenkins

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

如何让Jenkins在另一台服务器上运行脚本并监视结果?

我希望Jenkins能够在另一台服务器上启动部署过程,但我希望该服务器上的进程实际执行deplyoment过程(出于安全原因,例如,而不是让jenkins服务器上的用户ssh到远程服务器和执行部署)并将部署状态报告给Jenkins.

看起来这样做的方法是利用Jenkins的能力来创建可以在其他服务器上运行的从属进程,执行脚本并将控制台输出,状态等报告回主服务器.

所以顺序是:

詹金斯(大师)

1. build - >

2.创建工件 - >

3.启动部署(使用ssh启动奴隶作业)jenkins(奴隶)

4.执行部署 - >

5.将状态报告给主jenkins服务器

这是实现我想做的适当方式吗?

deployment artifacts master-slave jenkins

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

getResources().getString()如何工作android

例如,有一个提供多语言支持的应用程序,在我的activity/UI中,我调用getResources().getString(R.string.hello)了strings.xml中存在的内容

values\strings.xml
values-ru\strings.xml
Run Code Online (Sandbox Code Playgroud)

现在在调用getResources().getString(R.string.hello)并需要根据系统区域设置访问字符串时,是否会从values\strings.xmlOR中获取字符串values-ru\strings.xml

要么

是否需要根据系统区域设置更改我的应用程序区域设置(保持应用程序区域设置与系统区域设置相同),然后从getString()以下链接中建议的内容中检索值

  1. 得到弦外之用字符串,在特定的默认语言环境,语言环境

  2. 如何对获得字符串从 - 不同,语言环境功能于安卓

我搜索了其他各种链接,但无法找到解决方案

string multilingual android locale android-resources

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

android:icon ="@ drawable/my_icon"和android:icon ="?my_icon"之间的区别?

我通常在xml中设置drawable as android:icon="@drawable/my_icon" 但是在某些项目中我看到了代码android:icon="?my_icon".

android:icon="@drawable/my_icon"和之间有什么区别android:icon="?my_icon"

android drawable

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

为什么android自定义对话框全屏显示

我正在尝试创建自定义对话框

基本布局(我也尝试了各种修改过的布局)

<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:background="@color/dialogHeaderBackground"
            android:gravity="center"
            android:minHeight="@dimen/minHeightDialogTitle"
            android:text=""
            android:textStyle="bold" />

        <TextView
            android:id="@+id/message"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/title"
            android:layout_marginTop="5dp"
            android:text="" />

        <LinearLayout
            android:id="@+id/loutButton"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_below="@+id/message"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="5dp"
            android:orientation="horizontal" >

            <Button
                android:id="@+id/btnNeutral"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="" />

            <Button
                android:id="@+id/btnNegative"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="" />

            <Button
                android:id="@+id/btnPositive"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="" />
        </LinearLayout>
    </RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

Java代码

        Dialog dialog = new Dialog(this);
//      Dialog dialog = new Dialog(this,R.style.Theme_Dialog);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

        dialog.setContentView(R.layout.custom_dialog);

        Button btnPositive=(Button) dialog.findViewById(R.id.btnPositive);
        Button btnNegative=(Button) …
Run Code Online (Sandbox Code Playgroud)

java android android-layout android-xml android-dialog

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