小编Cou*_*son的帖子

在Android中添加ListView子项文本

我创建了一个RSS阅读器,列出了listview中的项目.我还想在每个项目下面有一个日期,但我不知道该怎么做.我需要别人的帮助才能使Sub Item文本显示从RSS feed检索到的pubDate.

这是我班上的代码:

public class RSSReader extends Activity implements OnItemClickListener
{
    public final String RSSFEEDOFCHOICE = "http://app.calvaryccm.com/mobile/android/v1/devos";

    public final String tag = "RSSReader";
    private RSSFeed feed = null;

    /** Called when the activity is first created. */

    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.main);

        // go get our feed!
        feed = getFeed(RSSFEEDOFCHOICE);

        // display UI
        UpdateDisplay();
    }

    private RSSFeed getFeed(String urlToRssFeed)
    {
        try
        {
            // setup the url
           URL url = new URL(urlToRssFeed);

           // create the factory
           SAXParserFactory factory …
Run Code Online (Sandbox Code Playgroud)

java android listview android-layout

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

阻止用户在表单字段中输入<或>

我试图阻止用户使用JavaScript将<或>输入到我的表单字段中.这是我到目前为止所拥有的:

$(document).on('keydown', function (e) {
    regex = new RegExp("\<|>");
    var key = String.fromCharCode(!event.charCode ? event.which : event.charCode);
    if (!regex.test(key)) {
        event.preventDefault();
        return false;
    }
});
Run Code Online (Sandbox Code Playgroud)

它仍然允许这些角色,我该如何阻止它?

javascript regex jquery

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

iPhone UITableView创建部分

我试图在我的UITableView中创建更多的部分,我似乎无法搞清楚.我希望将"查看完整网站"和"视频"链接移动到他们自己的部分,并将这些单元格的高度更改为75.我可以创建一个新单元格,但我无法弄清楚如何正确定位它.

    typedef enum { SectionHeader, SectionDetail } Sections;
    typedef enum { SectionHeaderTitle, SectionHeaderDate, SectionHeaderURL,            SectionHeaderEnclosure } HeaderRows;
    typedef enum { SectionDetailSummary } DetailRows;

    @implementation MediaDetailTableViewController

    @synthesize item, dateString, summaryString, teachings;

    #pragma mark -
    #pragma mark Initialization

    - (id)initWithStyle:(UITableViewStyle)style {
    if ((self = [super initWithStyle:style])) {

    }
    return self;
    }

    #pragma mark -
    #pragma mark View lifecycle

    - (void)viewDidLoad {

    // Super
    [super viewDidLoad];

    // Date
    if (item.date) {
        NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
        [formatter setDateStyle:NSDateFormatterMediumStyle];
        [formatter setTimeStyle:NSDateFormatterMediumStyle];
        self.dateString = …
Run Code Online (Sandbox Code Playgroud)

iphone xcode objective-c uitableview

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

使用SimpleDate的Android日期格式

我正在开发一个Android解决方案,包含12个不同的项目,我需要帮助为每个项目创建日期.这是我到目前为止:

TextView detailsPubdate = (TextView)findViewById(R.id.detailspubdate);

我希望日期看起来像这样:9月3日星期六.谢谢你的帮助!

android simpledateformat

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

iPhone在UITableViewCell中包装文本

我正在尝试使用大字体创建一个UITableView单元格,其中显示"查看此灵修在线".我遇到的问题是单元格中的文本没有包装,所以我最终得到了部分短语.

文字没有包装

我的代码是:

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

// Get cell
static NSString *CellIdentifier = @"CellA";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
}

// Display
cell.textLabel.textColor = [UIColor blackColor];
cell.textLabel.font = [UIFont systemFontOfSize:15];
if (item) {

    // Item Info
    NSString *itemTitle = item.title ? [item.title stringByConvertingHTMLToPlainText] : @"[No Title]";

    // Display
    switch (indexPath.section) {
        case SectionHeader: { …
Run Code Online (Sandbox Code Playgroud)

iphone xcode objective-c word-wrap uitableview

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

iPhone XCode UITabBarController和UINavigationController

当我收到以下错误时,我正在尝试更新我的应用程序以在iPhone 5上工作:

Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency',
reason: 'A view can only be associated with at most one view controller at a time!
View <UITableView: 0x88fbe00; frame = (0 20; 320 548); clipsToBounds = YES; opaque = NO; 
autoresize = W+H; gestureRecognizers = <NSArray: 0x8395940>; layer = <CALayer: 0x8395350>;
contentOffset: {0, 0}> is associated with <UIViewController: 0x83967d0>. Clear this
association before associating this view with <UIViewController: 0x8381220>.'
Run Code Online (Sandbox Code Playgroud)

我正在运行XCode版本4.5,这从未发生过.我试图按照这个问题中的步骤进行操作.这就是我的MainWindow.xib的样子:

的MainWindow.xib

我做错了什么,我该如何解决?

iphone uinavigationcontroller ios

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

Javascript将rel属性赋值给变量

我创建了一个用户图像表,点击后会启动视频.以下是该表的相关部分:

<table>
<tbody>
    <tr>
        <td style="width: 220px;">
        <p><a rel="MP4:webvideos/Featured/Christina" href="#" class="mediamodal videoLink"><img alt="" src="/images/featured/christina.png" /></a><br />
        Overall Vision</p>
        </td> 

        <td style="width: 220px;">
        <p><a rel="MP4:webvideos/Featured/Logan" href="#" class="mediamodal videoLink"><img alt="" src="/images/featured/logan.png" /></a><br />
        Video Control</p>
        </td>
....
Run Code Online (Sandbox Code Playgroud)

现在,我必须使用视频的rel属性才能工作.这是我目前用于获取rel属性的Javascript:

var mediaDetails = $(".videoLink").attr("rel");
Run Code Online (Sandbox Code Playgroud)

这适用于单个文件,但我有一个充满图像的表,需要成为启动视频的可点击链接.

如何将mediaDetails变量分配给rel属性中的特定链接?

html javascript jquery

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