我重写了CursorAdapter,我需要得到最后一项,问题是CursorAdapter实际上有一个get()方法......但是source是一个db,它返回一个普通的对象!(我甚至不知道它是什么,我希望它返回一个Cursor对象......)
无论如何,我如何让它返回我的Wrapper数据库行类的实例?
示例:说我的db有这样的行:
id |名字| 姓
我从那里做了一个班级的人.
现在我想从游标适配器获得一个Person get(int i)方法...
我正在开发锁屏,我想要在冰淇淋三明治和果冻豆中禁用主页按钮,我可以使用以下方法在Android 2.2,2.3中阻止它
@Override
public void onAttachedToWindow() {
// TODO Auto-generate method stub
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
super.onAttachedToWindow();
}
Run Code Online (Sandbox Code Playgroud)
也尝试了这个
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
Run Code Online (Sandbox Code Playgroud)
在这里,我也没有通过onPauseMethod或者获取事件信息onKeyDown
但是这些方法在ICS中对我没有用,如果有任何方法可以取代它,那么让我知道
我们中的许多人必须遇到像Tinder和Dripper这样的应用程序,您可以在其中下拉包含图像的视图并放大图像.然后当您放开时,图像会缩小以返回其原始状态.
让我们以Tinder为例:
原来的状态:和放大的状态时,拉:

在iOS中完成它
- (void)viewDidLoad {
[super viewDidLoad];
self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"church-welcome.png"]];
self.imageView.contentMode = UIViewContentModeScaleAspectFill;
self.cachedImageViewSize = self.imageView.frame;
[self.tableView addSubview:self.imageView];
[self.tableView sendSubviewToBack:self.imageView];
self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 170)];
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGFloat y = -scrollView.contentOffset.y;
if (y > 0) {
self.imageView.frame = CGRectMake(0, scrollView.contentOffset.y, self.cachedImageViewSize.size.width+y, self.cachedImageViewSize.size.height+y);
self.imageView.center = CGPointMake(self.view.center.x, self.imageView.center.y);
}
}
Run Code Online (Sandbox Code Playgroud)
由于我在Objective C和iOS方面的专业知识非常有限,我无法在Android中实现它.
以下是我认为应该做的事情:
有没有人知道是否有任何库可以用于此目的?
在我的ICS(Android 4.0.4)平板电脑上运行Google语音搜索会产生奇怪的行为,并出现以下警告:
W/PackageManager( 1571): Unknown permission com.google.android.voicesearch.SHORTCUTS_ACCESS in package com.google.android.googlequicksearchbox
W/PackageManager( 1571): Unknown permission com.google.android.voicesearch.AUDIO_FILE_ACCESS in package com.google.android.gm
W/RecognitionManagerService( 1571): no available voice recognition services found
I/ActivityManager( 1571): Start proc com.android.voicedialer for broadcast com.android.voicedialer/.VoiceDialerReceiver: pid=2130 uid=10033 gids={3002}
I/ActivityManager( 1571): No longer want com.android.voicedialer (pid 2130): hidden #16
I/ActivityManager( 1571): Force stopping package com.google.android.voicesearch uid=10074
W/PackageManager( 1571): Unknown permission com.google.android.apps.googlevoice.permission.AUTO_SEND in package com.google.android.voicesearch
D/BackupManagerService( 1571): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.google.android.voicesearch flg=0x10000010 (has extras) }
Run Code Online (Sandbox Code Playgroud)
很想知道为什么,我查了一下Manifest.permission列表,但我找不到任何提及:
我知道StackOverflow的规则,因此事先为这个主观问题道歉.
我尝试了文档,但它说的是:
RemoteControlClient可以显示意图由能够显示元数据,艺术作品和媒体传输控制按钮的遥控器使用的信息.
远程控制客户端对象与媒体按钮事件接收器相关联.在通过registerRemoteControlClient(RemoteControlClient)注册RemoteControlClient之前,此事件接收器必须先在registerMediaButtonEventReceiver(ComponentName)中注册.
我不了解其他人,但对我而言,这些文档还不足以出现像"RemoteControlClient"这样酷炫的名字.
我搜索了很多论坛但不幸的是,这个概念对我来说仍然不清楚.
如果有人帮我理解它,它是如何工作的,最重要的是它能够做到的一切,那真的很感激.
在此先感谢并向主观问题提出道歉.
我从一开始就是Windows开发人员,现在的趋势决定了我专注于更新的技术和平台.
我的问题是如何开始Android开发,可以在Windows 7的Windows PC上完成,如果是的话我需要什么工具.
我知道如何制作一个警告对话框,但是我需要用一个微调器来制作一个,这样当它弹出时,这个人就可以选择发生什么.有没有人有一个与微调器的警报对话框的代码或知道任何好的教程?
提前致谢
为什么我TextView不对劲?
更新:好吧,现在我不需要设置TextView为正确.现在非常有趣的是为什么layout_gravity不按预期工作,即 - 设置View到父容器内的位置.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
style="@style/activated_item"
android:orientation="horizontal">
<CheckBox
android:id="@+id/star"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
style="?android:attr/starStyle"/>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginLeft="8dp"
android:layout_gravity="right" //////// HERE I AM
android:textStyle="bold"
android:textColor="@color/item_text_color"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我遵循了关于在我的应用程序中获取动作栏的教程.但即使我放入android:uiOptions="splitActionBarWhenNarrow"我的Manifest文件,它仍然保持在顶部.任何人对如何处理此代码有任何想法?
XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#f0f0f0"
android:baselineAligned="false">
<LinearLayout
android:id="@+id/myFragments"
android:layout_width="match_parent"
android:layout_height="0dp">
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
清单文件:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.alotoftesting"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:uiOptions="splitActionBarWhenNarrow">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud) 在我的Android应用程序中,我试图从他的Facebook帐户获取用户的封面照片.
我可以使用下面的代码获取个人资料图片.
profilePicUrl = new URL("http://graph.facebook.com/" + userId + "/picture?type=large");
profilePicBmp = BitmapFactory.decodeStream(profilePicUrl.openConnection().getInputStream());
Run Code Online (Sandbox Code Playgroud)
该文档指定了以下用于检索封面照片.
用户的封面照片(必须使用fields = cover参数明确请求)
需要access_token
返回:字段数组id,source和offset_y
因此,JSON响应的结构将是这样的.
{
"cover": {
"cover_id": "10151008748223553",
"source": "http://sphotos-a.ak.fbcdn.net/hphotos-ak-ash4/s720x720/391237_10151008748223553_422785532_n.jpg",
"offset_y": 0
},
"id": "19292868552"
}
Run Code Online (Sandbox Code Playgroud)
我是Facebook Graph API的新手,因此对如何解决这个问题知之甚少.
我试过这个 coverPicUrl = new URL("http://graph.facebook.com/" + userId + "/cover?type=large");
还有这个 coverPicUrl = new URL("http://graph.facebook.com/" + userId + "/fields=cover");
但我无法获得用户个人资料的封面图片.
在线搜索也没有取得任何丰硕成果.
任何帮助确实会受到赞赏.
谢谢!
android ×10
android-4.0-ice-cream-sandwich ×1
facebook ×1
home-button ×1
imageview ×1
java ×1
layout ×1
xml ×1
zoom ×1