小编Reg*_*ent的帖子

在RelativeLayout中使用<include>

我有一个有一个孩子的RelativeLayout<include another.xml>

像这样root.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
     android:orientation="horizontal">
<include layout="@layout/another.xml"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

我的问题是Android是否尊重android:layout_alignParentRight="true"我的顶级水平another.xml

another.xml是这样的:

<RelativelLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/control_panel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:orientation="vertical">
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

基本上,我希望我的所有观点都another.xml与我的根本正确对齐.我上面已经尝试过了,但是我的视图another.xml与我的根保持一致.

谢谢.

android android-layout

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

使用ajax或回发到动作的差异

所以我的问题有点怪异,因为我没有了解它(ajax方法)

我只是重用了遇到的原始功能,对其进行了重命名和测试。

因此,在其他不同情况下(更常见):

一些<asp:TextBox>控件,一个提交按钮。

与C#asp.net PostBack相比,Ajax有什么优势?

这是代码

 function AppsName_AjxUpdt(CurrentColumn, recNumSplited, newValue, TBX, ActionRequest, RecordNum) {
        $.ajax({
            type: 'POST',
            url: 'YourPageNameHere.aspx',
            data: {
                'PostSentByAjax': "true",
                'CurrentColumn': CurrentColumn,
                'recNumSplited': recNumSplited,
                'value': newValue,
                'ActionRequest': ActionRequest
            },
            success: function (data) {
                //alert(data);
                if (type == "UpdateUserID") {
                    TBX.setAttribute(defaultValue, newValue);

                    refreshData();
                }
                if (type == "reason") {
                    window.form1.submit();
                }

                if (type == "delete") {
                    document.getElementById("row_" + rowid).style.display = "none";
                    document.getElementById("totalMins").innerHTML = "<span style='text-decoration:underline;color:#A7C942;cursor:pointer;' onclick='refreshData();'>Refresh Results</span>";
                }
            }
        });
    }
Run Code Online (Sandbox Code Playgroud)

那么,将这种代码行为与绑定<asp:TextBox>到自动回发功能有何不同?我可以说我 …

ajax jquery postback asp.net-4.0 c#-4.0

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

Objective-C的"stringWithFormat:"方法怎么了?

当我定义

NSString *testString = [NSString stringWithFormat:@"%4d", 543210];
Run Code Online (Sandbox Code Playgroud)

然后testString@"543210",而不是@"3210"

这曾经在Xcode v4.3.1中工作,但现在我升级到v4.6并且它停止工作.

有任何想法吗?

cocoa objective-c

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

全局,动态地替换(null)为'0'

我继承的项目有很多带字符串值的变量.他们的唯一目的是帮助检查某些事情是真是假.在整个程序中为这些变量分配的值是:

  • (null)
  • 0
  • any integer value > 0
  • true
  • false

有没有一种简单的方法可以确保无论何时(null)分配给它们,它都会自动被分配一个0FALSE相反.

这样if(...)条件将更容易处理.

iphone objective-c ios

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

我需要在php中的字符串中找到第一个元音的位置

我需要在单个字符串中找到第一个元音的位置.例如.

  • garbage 会回来的 1
  • plastic 会回来的 2
  • apple 会回来的 0

我是初学者,所以我很难接受这个.我想我需要一个带有数组或正则表达式的循环.

php

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

从moreNavigationController中删除编辑按钮不起作用

通过从中删除编辑按钮我遇到了一些问题moreNavigationController.

我无法找到错误,它必须是一个简单的错误.

我创建了一些TabBarViewController与IB连接的IB TabBarViewController.

这是代码:

TabBarViewController.h:

    #import <UIKit/UIKit.h>

@interface TabBarViewController : UITabBarController <UINavigationControllerDelegate, UITabBarControllerDelegate>


@end
Run Code Online (Sandbox Code Playgroud)

TabBarViewController.m:

#import "TabBarViewController.h"

@interface TabBarViewController ()

@end

@implementation TabBarViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.

     self.delegate = self;

   [self.moreNavigationController.navigationBar setBarStyle:UIBarStyleBlackOpaque];
    [self.moreNavigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navbar.bg.png"] forBarMetrics:UIBarMetricsDefault];
    [self.moreNavigationController.navigationBar.topItem setRightBarButtonItem:nil];   

}

- (void)didReceiveMemoryWarning …
Run Code Online (Sandbox Code Playgroud)

objective-c

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

ios ble - Write Without Response"属性 - 忽略无响应写入

在iOS7.1.1上,以下BLE操作成功 - 它假设我有一个BLE连接设置等...

[[self peripheral]writeValue:dataToWrite forCharacteristic:nextCharacteristic type:CBCharacteristicWriteWithResponse];
Run Code Online (Sandbox Code Playgroud)

但如果我切换"类型" CBCharacteristicWriteWithoutResponse,我得到以下警告,外围设备没有收到命令:(

[[self peripheral]writeValue:dataToWrite forCharacteristic:nextCharacteristic type:CBCharacteristicWriteWithoutResponse];
Run Code Online (Sandbox Code Playgroud)

错误:

CoreBluetooth[WARNING] Characteristic <CBCharacteristic: 0x178081f90 UUID = 249C2001-00D7-4D91-AC75-22D57AE2FFB8, Value = (null), Properties = 0x28, Notifying = YES, Broadcasting = NO> does not specify the "Write Without Response" property - ignoring response-less write**
Run Code Online (Sandbox Code Playgroud)

任何线索都赞赏!

ios core-bluetooth bluetooth-lowenergy

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

如何在javascript中解析英尺的字符串?

我被卡住了.这个很容易.但是,它已成为我的噩梦.

我无法解析这个字符串并存储到两个名为feet和的变量中inch.

  var f = "5'9''"; // 5 feet 9 inch 

  var nn = f.indexOf("\'");
  var feet = f.substring(0, nn);

  var inch = f.substring(nn + 1, f.lastIndexOf("\'\'")-1); 
Run Code Online (Sandbox Code Playgroud)

输出inch应该是9,但是nil.

javascript

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

如何在iPhone中上传参数以及图像和音频

我是iPhone编程的新手.任何人都可以告诉我,我已经上传了图像和音频以及这些参数

输入参数:caption,user_id,mobile_tauky_id,blauky_id,image,audio(captionblauky_id可选)

使用下面的代码我可以上传image,同样地,我想先上传caption,user_id意味着一些整数值ex: 3,mobile_tauky_id也有一些整值ex: 5,blauky_id也例如:2,imageaudio.

我在哪里可以追加这些参数,首先我要追加标题,旁边user_id,然后mobile_tauky_id,blauky_id之后,我要追加imageaudio.任何机构都可以告诉我如何在下面的代码中附加这些参数.我只能追加,image但在此之前我想追加user_id,mobile_tauky_id.

NSString *urlString = @"http://182.73.152.59:82/php/tauky_services/codeigniter-restserver-master/index.php/api/uploadClass/uploadTauky/";
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init] ;
[request setURL:[NSURL URLWithString:urlString]];
[request setHTTPMethod:@"POST"];
boundary = @"---------------------------14737809831466499882746641449";
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios

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

将2个正则表达式合并为一个

我想要一个正则表达式: - 检查前2个字符等于04 - 检查长度是10并包含数字

我有这个,并尝试了很多东西但是找不到如何使用'和'组合二合一或者如果我有第一次检查甚至是正确的...

pattern = "(04{1,1})/([0-9]{10,10})"
Run Code Online (Sandbox Code Playgroud)

javascript regex

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

将ISO8601字符串转换为DateTime格式?

我有一个字符串20130510T202132Z,我想转换成一个DateTime对象.

我一直在尝试使用Joda来实现这一点,但我无法让它工作.我已经找到了我能找到的关于这个主题的每一个链接 - 并且使用了格式化程序,但它根本就没有用完.

做这个的最好方式是什么?

java date jodatime

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