我有一个扩展PreferenceActivity的活动.我正在从xml文件加载首选项.但在某些情况下,我需要根据我的应用状态完全隐藏屏幕中的一个偏好设置.有一个setEnabled方法,但它不是我想要的.我想完全从屏幕上删除该首选项.可能吗 ?
嗨我正在从偏好设置屏幕启动活动.活动在三个偏好中共享.我想知道我是否可以在xml中为此活动设置额外内容
<Preference
android:key="action_1"
android:title="@string/action_1_title"
>
<intent
android:action="com.package.SHAREDACTION"
>
</intent>
</Preference>
Run Code Online (Sandbox Code Playgroud)
我想知道我能做些什么
<extras>
<item
android:name=""
android:value=""/>
</extras>
Run Code Online (Sandbox Code Playgroud)
我需要做的就是传递一个整数.我可以采取不同的行动并检查行动而不是额外的行动.
我正在通过禁用标准版本并自行管理所有内容来为活动创建自定义标题.我想知道是否可以根据我的需要更换/主题标题.
我可以通过更改windowXYZStyle项目来自定义大小,背景图像和文本.
我唯一找不到的东西 - 我怎么能添加图像而不是文字.我已经尝试requestWindowFeature(Window.FEATURE_CUSTOM_TITLE)
并分配自定义布局 - 但它似乎不起作用.
编辑:这是测试建议的报告,代码如下 - 结果 - 图像视图没有显示.
活动
public class SettingsActivity extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.settings);
}
}
XML :
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="26dip"
android:paddingLeft="5dip"
android:background="@drawable/titlebar_bg"
android:layout_gravity="left|center"
>
<ImageView
android:id="@+id/logo"
android:src="@drawable/title_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我已经阅读了所有可能的博客和关于这个主题的SO帖子 - 但仍然不确定发生了什么.我也读过这个但仍然没有运气 - 他们的默认迁移指南有点清楚但在我的情况下不起作用.我对iOS开发比较陌生,所以要温柔:)
情况如下:在我的应用程序(iOS)中名为Report的实体上,需要进行以下更改:
数据属性 - 已删除
title属性 - 已添加
reportId属性需要从Integer 16更改为String.这就是造成我问题的原因.我确实从当前版本创建了我的数据模型的新版本并修改了属性.
首先,这里是应用程序的一些方法:
- (NSManagedObjectModel *)managedObjectModel
{
if (__managedObjectModel != nil)
{
return __managedObjectModel;
}
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"App" withExtension:@"momd"];
__managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
return __managedObjectModel;
}
Run Code Online (Sandbox Code Playgroud)
然后
/**
Returns the persistent store coordinator for the application.
If the coordinator doesn't already exist, it is created and the application's store added to it.
*/
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
if (__persistentStoreCoordinator …Run Code Online (Sandbox Code Playgroud) 我有一个奇怪的问题.我正在解析一个包含大文本字段的文档.在我的角色部分,我正在使用StringBuilder
currentStory.append(ch, start, length);
Run Code Online (Sandbox Code Playgroud)
然后在我的endElement中我将它分配给我对象上的相应字段.
if (name.equals(tagDesc)) {
inDesc = false;
if (currentItem != null ) {
currentItem.setSummaryText(currentStory.toString());
}
currentStory.setLength(0);
}
Run Code Online (Sandbox Code Playgroud)
setSummaryText(String text) 方法是:
public void setSummaryText(String text) {
Story = text;
}
Run Code Online (Sandbox Code Playgroud)
而且我的内存耗尽了.
如果我将setSummaryText改为像这样完全奇怪的东西
public void setSummaryText(String text) {
char[] local = text.toString()
Story = new String(local);
}
Run Code Online (Sandbox Code Playgroud)
我很好.我只是无法弄清楚我拿着那个参考?Story是用""初始化的对象的成员var; 注 - 分配给本地String变量而不是char [] - 也会失败.
android ×4
core-data ×1
extras ×1
intentfilter ×1
ios ×1
memory-leaks ×1
migration ×1
preferences ×1
sax ×1
titlebar ×1
versioning ×1
window ×1