小编xue*_*eru的帖子

尝试使用Window.FEATURE_CUSTOM_TITLE,但得到例外:您无法将自定义标题与其他标题功能组合在一起.

我正在尝试使用自定义标题在标题栏中包含图像按钮.我在这篇文章中得到了很多帮助:android:在应用程序的标题中添加按钮?,但无法使其适用于我的ListActivity.

简而言之,以下就是我所拥有的:

  1. 我隐藏了AndroidManifest.xml中的标题栏
  2. 指定自定义标题的相对布局(workorder_list_titlebar.xml)

  3. 我的活动类如下所示:

    public class WorkOrderListActivity extends ListActivity {
     String[] orders={"WO-12022009", "WO-12302009","WO-02122010", "02152010"};
     @Override
     public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);   
       requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
       this.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.workorder_list_titlebar);
       setContentView(R.layout.workorder_list);
       setListAdapter(new ArrayAdapter(this,R.layout.workorder_list, R.id.label,orders));    
            }
    }

当我运行应用程序时,我得到了AndroidRuntimeException:您无法将自定义标题与其他标题功能组合在一起.

基于堆栈跟踪,com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:183)抛出异常,该异常由setlistAdapter调用触发.

有没有人与ListActivity有同样的问题?此外,一旦我设法完成这项工作,我如何将监听器附加到图像按钮才能执行某些操作?

提前致谢.

android

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

应用程序关闭哪个事件?

我正在使用jQueryMobile和phoneGap来实现跨设备的移动应用程序.我使用html 5本地存储来保存用户使用的记录.

我不知道在应用程序关闭之前要捕获哪个phoneGap事件,因此我可以确保在关闭完成之前保存数据.

根据naughtur的建议,我尝试了卸载和beforeunload事件,它们都没有在应用程序关闭期间被解雇.以下是我的代码片段:

function persistTasks(){
    alert ("is unloading the app");
    offlineTasklist.set("tasks", tasklist); 
}

function init() {
    document.addEventListener("unload", persistTasks, false);
    login();
}

$(document).ready(init);
Run Code Online (Sandbox Code Playgroud)

jquery-mobile cordova

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

如何为jqGrid的ajax对象设置请求标头

我需要将'Authorization'请求标头设置为httpXMLRequest.在网格定义中,我尝试通过ajaxGridOptions设置如下:

 ajaxGridOptions: { Authorization: 'Basic YWRtaW5AZGVmYXVsdC5jb206YWRTwa6=' } 
Run Code Online (Sandbox Code Playgroud)

并使用beforeSend事件,如下所示:

   beforeSend:  function(jqXHR, settings) {
    jqXHR.setRequestHeader("Authorization", 'Basic YWRtaW5AZGVmYXVsdC5jb206YWRTwa6=');
                    }
Run Code Online (Sandbox Code Playgroud)

以上都不适合我.什么是正确的语法?

谢谢!!

ajax jqgrid

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

responseObject不是JSON,而是AFHTTPRequestOperationManager的NSInLineData

以下代码是通过operationQueue提交图像.请求都是正确地逐个触发,服务器响应包含客户端需要掌握的图像文件名.问题是成功/失败块的reponseObject不是预期解析的JSON,而是调试器中显示的NSInLineData类型.现在我怀疑从NSMutableURLRequest构造操作的代码导致了这个问题.请帮忙.

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.responseSerializer = [AFJSONResponseSerializer serializer];

NSMutableURLRequest *request = [manager.requestSerializer multipartFormRequestWithMethod:@"POST"      
            URLString:podURLString parameters:nil
            constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {

            NSError *error;
            BOOL success =[formData appendPartWithFileURL:imgURL name:@"images" fileName:img.path 
               mimeType:@"image/jpg" error:nil];
            if (!success)
                    NSLog(@"appendPartWithFileURL error: %@", error);} error:nil];

AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
   NSLog(@"Image Success: %@", [responseObject description]);

   NSString *imagePath = [response objectForKey:@"imageFileName"];

   [self.delegate networkManager:self didSubmitDeliveryImageForImageID:imagePath];


} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
  NSLog(@"Image Error: %@", error);
  NSLog(@"image error: %@", [operation.responseObject description]);

 NSString *imageFilePath = …
Run Code Online (Sandbox Code Playgroud)

ios afnetworking-2

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

如何比较UITextField的实例

我在一个视图上有3个UITextFileds,我想在UITextFieldDelegate方法中只在其中两个中应用逻辑,我如何确定触发回调的UITextField?

提前谢谢了!

iphone

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

标签 统计

afnetworking-2 ×1

ajax ×1

android ×1

cordova ×1

ios ×1

iphone ×1

jqgrid ×1

jquery-mobile ×1