小编llo*_*kes的帖子

{"<user xmlns =''>不是预期的.}反序列化Twitter XML

所以我通过OAuth从Twitter中提取XML

所以我正在向http://twitter.com/account/verify_credentials.xml提出请求

返回以下XML

<?xml version="1.0" encoding="UTF-8"?>
<user>
  <id>16434938</id>
  <name>Lloyd Sparkes</name>
  <screen_name>lloydsparkes</screen_name>
  <location>Hockley, Essex, UK</location>
  <description>Student</description>
  <profile_image_url>http://a3.twimg.com/profile_images/351849613/twitterProfilePhoto_normal.jpg</profile_image_url>
  <url>http://www.lloydsparkes.co.uk</url>
  <protected>false</protected>
  <followers_count>115</followers_count>
  <profile_background_color>9fdaf4</profile_background_color>
  <profile_text_color>000000</profile_text_color>
  <profile_link_color>220f7b</profile_link_color>
  <profile_sidebar_fill_color>FFF7CC</profile_sidebar_fill_color>
  <profile_sidebar_border_color>F2E195</profile_sidebar_border_color>
  <friends_count>87</friends_count>
  <created_at>Wed Sep 24 14:26:09 +0000 2008</created_at>
  <favourites_count>0</favourites_count>
  <utc_offset>0</utc_offset>
  <time_zone>London</time_zone>
  <profile_background_image_url>http://s.twimg.com/a/1255366924/images/themes/theme12/bg.gif</profile_background_image_url>
  <profile_background_tile>false</profile_background_tile>
  <statuses_count>1965</statuses_count>
  <notifications>false</notifications>
  <geo_enabled>false</geo_enabled>
  <verified>false</verified>
  <following>false</following>
  <status>
    <created_at>Mon Oct 12 19:23:47 +0000 2009</created_at>
    <id>4815268670</id>
    <text>&#187; @alexmuller your kidding? it should all be &quot;black tie&quot; dress code</text>
    <source>&lt;a href=&quot;http://code.google.com/p/wittytwitter/&quot; rel=&quot;nofollow&quot;&gt;Witty&lt;/a&gt;</source>
    <truncated>false</truncated>
    <in_reply_to_status_id>4815131457</in_reply_to_status_id>
    <in_reply_to_user_id>8645442</in_reply_to_user_id>
    <favorited>false</favorited>
    <in_reply_to_screen_name>alexmuller</in_reply_to_screen_name>
    <geo/>
  </status>
</user>
Run Code Online (Sandbox Code Playgroud)

我使用以下代码来反序列化

    public User VerifyCredentials()
    {
        string …
Run Code Online (Sandbox Code Playgroud)

c# twitter xml-serialization

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

android返回活动时会被销毁并且不会恢复

我正在构建一个Android应用程序,其中包含两个使用Action Bar的活动(https://github.com/johannilsson/android-actionbar,因为我的目标是Android 2.2).

它有许多活动.有一个名为Feed的"Home"活动和另一个名为"Settings"的活动.

我遇到的问题是使用我正在使用的操作栏的示例中给出的createIntent函数,当用户点击主页按钮返回Feed活动时,Activity仍会被销毁而不是恢复.

通过一些调试我发现它被破坏了,而不是当Activity首次暂停和停止时,但是当它恢复请求时.

public static Intent createIntent(Context context) 
{        
    Intent i = new Intent(context, Feed.class);        
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);        
    return i;    
}
Run Code Online (Sandbox Code Playgroud)

这是一个主要的烦恼,并且大大减慢了应用程序的速度,因为它必须重新加载其数据(缓存,但它不是即时重新加载数据).

那我怎么能避免这种行为呢?为什么会发生这种情况,因为我相信额外的旗帜应该会阻止这种行为.

android android-actionbar

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

错误 - 找不到与给定名称匹配的资源(在'MvxItemTemplate'处,值为'@ layout/WorkViewItem')

我发布了这个问题,因为IT花了我两天的时间来解决这个问题.我认为其他人也可能会被它困住.所以在这里有解决方案可以帮助其他人.

WorkItemSelectionView.axml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res/Lloyd.Droid"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="10dp">
    <TextView
        android:text="Tasks:"
        android:layout_width="fill_parent"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:layout_height="wrap_content"
        android:textStyle="bold" />
    <Mvx.MvxListView
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        local:MvxBind="ItemsSource WorkItems; ItemClick SelectionCommand"
        local:MvxItemTemplate="@layout/WorkItemView" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

WorkItemView.axml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res/CCHQ.Droid"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textSize="30dp"
        local:MvxBind="Text Name" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

无法使用错误消息进行编译:

No resource found that matches the given name (at 'MvxItemTemplate' with value '@layout/WorkViewItem')
Run Code Online (Sandbox Code Playgroud)

android xamarin.android mvvmcross xamarin

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

iOS自定义表格视图单元格标签调整大小损坏

我正在为客户编写一个iOS应用程序,主视图是一个表视图,我用文本填充单元格,就像大多数iOS twitter客户端一样.

我创建了一个带有3个标签的自定义单元格视图,并使用文本填充这些标签.其中一个标签需要根据文本的数量自动调整大小(最多140个字符).

这工作正常,直到我向上/向下滚动列表,当文本延伸到一个完整的行(如标签已扩展)或只占用部分空间,因此它更深入,溢出到其他标签(我确实有根据另一个类似的SO问题启用"剪辑子视图"

因此,当首次加载表及其数据时,屏幕如下所示:

滚动之前http://lloydsparkes.co.uk/files/iOS-BeforeScrolling.png

经过一些滚动后,它看起来像:

滚动后http://lloydsparkes.co.uk/files/iOS-AfterScrolling.png

所以看起来标签在滚动过程中正在调整大小(可能是由于同一个单元被重用了?)而没有调整大小到正确的大小.

我填写单元格的代码是:

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

static NSString *myID = @"customCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:myID];

if(cell == NULL) {

    [[NSBundle mainBundle] loadNibNamed:@"CustomCellView" owner:self options:nil];

    cell = customCell;
    self.customCell = nil;
}

Post *p = [posts objectAtIndex:indexPath.row];

UILabel *label = (UILabel*)[cell viewWithTag:15];
label.text = p.Name;

label = (UILabel*)[cell viewWithTag:10];
label.text = p.Text;
[label sizeToFit];

label = (UILabel*)[cell viewWithTag:20];
label.text = [p Source];

//[cell layoutSubviews];

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

所以我要问的是,是什么导致了这个问题?它怎么解决?

iphone objective-c uikit uilabel ios

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