小编She*_*lam的帖子

如何在Android屏幕键盘上方放置布局?

见附图.Twitter做得很好.他们有一个布局,我称之为工具栏,缺少一个更好的术语,就在屏幕键盘上方.我怎么能用我的代码做到这一点?

在此输入图像描述

更新: 这是我的布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#ffffff">
    <RelativeLayout android:id="@+id/actionbarRelativeLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/actionbar_gradient">
        <ImageButton android:id="@+id/imageButton" android:layout_width="wrap_content" android:background="@drawable/stocktwits" android:layout_height="wrap_content"></ImageButton>
        <TextView android:layout_width="wrap_content" android:id="@+id/charCountTextView" android:text="140" android:layout_alignParentRight="true" android:layout_height="wrap_content" android:textColor="#ffffff" android:textStyle="bold" android:textSize="18sp" android:gravity="center_vertical" android:layout_centerVertical="true"></TextView>
    </RelativeLayout>
    <EditText android:layout_width="match_parent" android:id="@+id/composeEditText" android:focusable="true" android:hint="Share an idea with the community" android:gravity="left|top" android:layout_height="fill_parent" android:layout_weight="1"></EditText>
    <LinearLayout android:layout_width="match_parent" android:id="@+id/border" android:background="#c4c4c4" android:baselineAligned="false" android:layout_height="1dp"></LinearLayout>
    <LinearLayout android:layout_height="wrap_content" android:id="@+id/toolbarLinearLayout" android:orientation="horizontal" android:padding="5dip" android:layout_width="fill_parent" android:background="@drawable/gray_toolbar_gradient">
        <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/shortenButton" android:background="@drawable/shortenbutton" android:layout_weight="0"></Button>
        <LinearLayout android:layout_height="match_parent" android:layout_width="wrap_content" android:id="@+id/linearLayout1" android:layout_weight="1"></LinearLayout>
        <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/twitterCheckBox" android:textColor="#000000" android:layout_weight="0" android:background="@drawable/twittergraybutton"></CheckBox>
        <Button android:layout_height="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

java keyboard android android-linearlayout

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


XCode文档 - 离线阅读

是否可以将iOS和OSX文档用于离线阅读?如果是这样,怎么样?

xcode cocoa cocoa-touch objective-c ios

20
推荐指数
3
解决办法
8548
查看次数

如何在单元格处于编辑模式时显示披露指示符?

我有一个可以编辑的UITableView.我正在显示单元格:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }

    // Configure the cell...
    STWatchList *mySTWatchList;
    mySTWatchList = [items objectAtIndex:indexPath.row];

    cell.textLabel.text = mySTWatchList.watchListName;

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

当用户正在编辑时,我想显示披露指标.我怎么能做到这一点?

iphone cocoa-touch objective-c uitableview

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

如何基于indexPath获取单元格文本?

我有一个超过5个UITabBarItems的UITabBarController,因此moreNavigationController可用.

在我的UITabBarController委托中,我执行以下操作:

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
//do some stuff
//...

UITableView *moreView = (UITableView *)self.tabBarController.moreNavigationController.topViewController.view;
    moreView.delegate = self;
}
Run Code Online (Sandbox Code Playgroud)

我想实现一个UITableViewDelegate,以便我可以捕获所选的行,设置自定义视图属性,然后推送视图控制器:

- (void)tableView:(UITableView *)tblView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{
  //how can I get the text of the cell here?
}
Run Code Online (Sandbox Code Playgroud)

当用户点击一行时,我需要获取单元格的文本.我怎么能做到这一点?

iphone cocoa-touch objective-c uitabbarcontroller uitableview

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

如何将徽章添加到可自定义的UITabBar?

我正在为我的UITabBarController的UITabBar添加徽章:

UITabBarItem *tbi = (UITabBarItem *)[stTabBarController.tabBar.items objectAtIndex:1];
tbi.badgeValue = @"2";
Run Code Online (Sandbox Code Playgroud)

但是,我的UITabBarController是可自定义的,因此索引可能会更改.如何确保徽章应用于正确的UITabBarItem?

iphone cocoa-touch objective-c uitabbarcontroller uitabbar

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

在Java/Eclipse中分组方法的任何方法?

我希望能够对类似的方法进行分组,并将它们显示在Eclipse的Outline视图中.这使得在大范围内更容易导航大量代码,并且更容易找到所需的方法.在Objective-C中,您可以设置一个pragma mark命令.

对java/eclipse有什么相似之处吗?

java eclipse pragma

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

无法使用NSDateFormatter格式化UTC日期

我有以下日期:

2011-10-20T01:10:50Z
Run Code Online (Sandbox Code Playgroud)

我希望它被格式化为

"M/d/yy 'at' h:mma"
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init];
    //The Z at the end of your string represents Zulu which is UTC
    [dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]];
    [dateFormatter setDateFormat:@"yyyy-dd-MM'T'HH:mm:ss'Z'"];
    NSDate* newTime = [dateFormatter dateFromString:[message valueForKey:@"created_at"]];

    //Add the following line to display the time in the local time zone
    [dateFormatter setTimeZone:[NSTimeZone systemTimeZone]];
    [dateFormatter setDateFormat:@"M/d/yy 'at' h:mma"];
    NSString* finalTime = [dateFormatter stringFromDate:newTime];
    [dateFormatter release];
    NSLog(@"%@", finalTime);    
Run Code Online (Sandbox Code Playgroud)

不幸的是,finalTime在这里是NULL.

iphone cocoa-touch objective-c nsdate nsdateformatter

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

没有进程在管道的另一端

我尝试连接到SQL Server 2005时收到此错误.我已启用TCP/IP,命名管道,并重新启动服务器,但这不起作用.

sql-server ssis sql-server-2005

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

如何检测UISearchBar/UITextField的输入暂停?

我有以下UISearchbar代码:

- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
    NSString* endpoint =[NSString stringWithFormat:@"http://www.someurl/",
                         [searchText stringByReplacingOccurrencesOfString:@" " withString:@"+"]];
    NSURL* url = [NSURL URLWithString:endpoint];
    NSURLRequest* request = [NSURLRequest requestWithURL:url];
    GTMHTTPFetcher* myFetcher = [GTMHTTPFetcher fetcherWithRequest:request];
    [myFetcher beginFetchWithDelegate:self didFinishSelector:@selector(searchResultsFetcher:finishedWithData:error:)];
}
Run Code Online (Sandbox Code Playgroud)

我希望在输入暂停后发送此请求,并在每次命中一个字符时重置计时器.我怎样才能做到这一点?

iphone cocoa-touch objective-c nstimer uisearchbar

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