文档(或任何人)是否讨论了默认值的dpi值
android:textAppearance="?android:attr/textAppearanceLarge"}android:textAppearance="?android:attr/textAppearanceMedium"}android:textAppearance="?android:attr/textAppearanceSmall"}SDK中的小部件?

换句话说,我们可以在不使用android:textAppearance属性的情况下复制这些文本视图的外观吗?
我们有许多iOS应用程序,有几个不同的开发人员参与其中.我不断注意到的一个问题是,我们的故事板中的视图将移出它们放置的位置或调整大小以使它们更小,在标签尺寸适合文本的标签上最初变得非常明显突然间正在截断他们的文字.
当开发人员没有直接对故事板进行任何编辑时,我注意到我们的视图的这些降级出现在我们的Git存储库的提交中.他们可能已经在Interface Builder中查看了故事板,但没有对故事板进行任何真正的更改.然而,这些变化与他们正在进行的工作一起得到了保存和承诺.
当我在负责提交之前和之后进行故事板文件之间的文本比较时,我看到对视图帧的小改动,例如:
<rect key="frame" x="203" y="8" width="362" height="29"/>
|
V
<rect key="frame" x="203" y="7.5" width="362" height="29"/>
Run Code Online (Sandbox Code Playgroud)
和
<rect key="frame" x="446.00000170260091" y="7" width="302" height="30"/>
|
V
<rect key="frame" x="446" y="7" width="302" height="30"/>
Run Code Online (Sandbox Code Playgroud)
和
<rect key="frame" x="364" y="3" width="200" height="38"/>
|
V
<rect key="frame" x="363" y="3" width="200" height="38"/>
Run Code Online (Sandbox Code Playgroud)
和
<rect key="frame" x="284" y="7" width="97" height="30"/>
| |
V V
<rect key="frame" x="283" y="7" width="96" height="30"/>
Run Code Online (Sandbox Code Playgroud)
和
<rect key="frame" x="384.00001078580522" y="7" width="101" height="30"/>
| |
V V
<rect key="frame" x="383.00000530853856" y="7" …Run Code Online (Sandbox Code Playgroud) 我正在使用new NavigationView从XML创建我的导航抽屉菜单.我需要在部分菜单项之间放置一个分隔符,它在我的应用程序各部分之间切换,以及底部的设置和帮助和支持链接.
在我看过的所有例子中,我看到如何通过将另一个放入<menu>一个<item>,但<item>需要具有android:title属性来完成,所以我能做的最好就是将标题留空,这在设置之前留下一个空的空格并提供帮助和反馈.
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_section_1"
android:icon="@drawable/ic_dashboard"
android:title="@string/section_1"
android:checked="true" /> <!-- default selection -->
<item
android:id="@+id/nav_section_2"
android:icon="@drawable/ic_dashboard"
android:title="@string/section_2" />
<item
android:id="@+id/nav_section_3"
android:icon="@drawable/ic_dashboard"
android:title="@string/section_3" />
</group>
<item android:title="@null"> <!-- I don't want a title or space here! -->
<menu>
<item
android:id="@+id/nav_settings"
android:icon="@drawable/ic_settings"
android:title="@string/settings" />
<item
android:id="@+id/nav_help_feedback"
android:icon="@drawable/ic_help"
android:title="@string/help_feedback" />
</menu>
</item>
</menu>
Run Code Online (Sandbox Code Playgroud)
我已经试过的各种组合<menu>,<item>以及<group>标签,但没有发现任何东西,将工作.例如,这具有使用上一组中的最后一项作为组标题的问题:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_section_1"
android:icon="@drawable/ic_dashboard"
android:title="@string/section_1"
android:checked="true" /> …Run Code Online (Sandbox Code Playgroud) 我UIButton在使用之前更改了s的标题:
- (void)setTitle:(NSString *)title forState:(UIControlState)state
Run Code Online (Sandbox Code Playgroud)
但我遇到的情况是UIButton我使用的是多行标题,如果在IB中从"普通"变为"归属",则只能正确居中.以这种方式更改标题时,通常的setTitle: forState:方法不再更新按钮.
如何更改属性的标题UIButton?
为了澄清,所以你不要以为我只是犯了一个愚蠢的错误,我已经使用调试器来查看属性UIButton并记录输出
- (NSString *)titleForState:(UIControlState)state
Run Code Online (Sandbox Code Playgroud)
使用后
- (void)setTitle:(NSString *)title forState:(UIControlState)state
Run Code Online (Sandbox Code Playgroud)
设置它返回刚刚设置的值.问题是只要标题设置为IB中的属性,它就不会改变按钮的外观.只需将其更改为plain,我的代码就可以正常工作.但这不是上面链接中描述的解决方案.
在几个开发人员在我们的某个应用程序中处理故事板后,我们现在在尝试在Xcode Interface Builder中打开故事板时收到此错误:
无法打开文档"MainStoryboard_iPhone.storyboard".该操作无法完成.(com.apple.InterfaceBuilder错误-1.)
检查控制台日志以获取其他信息.
我们都在运行最新版本的Xcode(4.6.2 4H1003),并且所有更改都是在Interface Builder中对故事板进行的.控制台日志中没有显示其他信息.我假设错误是指同一个控制台日志,其中显示日志和调试语句,这是完全空的.
当我尝试在我正在处理的另一个应用程序中打开故事板时,其中一个开发人员收到同样的错误.这个故事板在我的计算机上可以在Xcode中打开,但是我们从不打扰在当时更多地查看错误(这是几个月前的第一次).但是这一次,我们都得到了同样的错误(我们中的4个人已经测试过在我们自己的计算机上打开它).
我们使用GitHub来管理两个项目的源代码控制,使用几个不同的Git客户端.有关导致此错误的原因以及如何解决此问题的任何想法?
更新:这是尝试打开故事板后计算机上/var/logs/system.log的输出:
Jun 5 16:38:44 my-computer-host-name Xcode[271]: Exception raised while unarchiving document objects - *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
Jun 5 16:38:45 my-computer-host-name Xcode[271]: [MT] DVTAssertions: Warning in /SourceCache/IDEKit/IDEKit-2113/Framework/Classes/Editor/IDEEditorDocument.m:1364
Details: Message sent to invalidated IBStoryboardDocument instance <IBStoryboardDocument: 0x40ecc34c0>. Backtrace for invalidation:
0 0x000000010d814f86 -[IDEEditorDocument _invalidate] (in IDEKit)
1 0x000000010d883291 -[IDEEditorDocument initForURL:withContentsOfURL:ofType:error:] (in IDEKit)
2 0x00000001103005d0 -[IBDocument initForURL:withContentsOfURL:ofType:error:] (in IDEInterfaceBuilderKit)
3 0x000000010d882efd +[IDEDocumentController _newEditorDocumentWithClass:forURL:withContentsOfURL:ofType:extension:error:] (in IDEKit)
4 0x000000010d882dba -[IDEEditorContext …Run Code Online (Sandbox Code Playgroud) 我需要将泛型类传递给类的构造函数.类是SpiceRequest从RoboSpice的Android库来构造参考.
奇怪的是,类需要将泛型类传递给contstructor,当它可以从泛型类型本身访问时,在这种情况下RESULT.class,但是我可能错了.无论如何,我不是要更改库的代码,而是需要使用泛型类型SpiceRequest,Map<String, ? extends Object>.这是我的代码:
SpiceRequest<Map<String, ? extends Object>> request =
new SpiceRequest<Map<String, ? extends Object>>(???) {
...
};
Run Code Online (Sandbox Code Playgroud)
和SpiceRequest构造函数的签名:
public SpiceRequest(final Class<RESULT> clazz) {
...
}
Run Code Online (Sandbox Code Playgroud)
对于??? 我试过Map.class编译错误:The constructor SpiceRequest<Map<String,? extends Object>>(Class<Map>) is undefined.
Map<String, ? extends Object>.class给出错误:Syntax error on tokens, PrimitiveType expected instead特别强调? extends Object.它也给出了相同的错误Map.class.
并且也Map.<String, ? extends Object>class给出了相同的编译器错误.
获取泛型类的正确方法是什么Class<Map<String, ? extends Object>> …
今天早些时候,我的Google App Engine应用中的服务电话停止工作,返回以下错误:
500服务器错误
如果问题仍然存在,请报告您的问题并提及此错误消息以及导致该问题的查询.
HTML代码:
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>500 Server Error</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered an error and could not complete your request.<p>If the problem persists, please <A HREF="http://code.google.com/appengine/community.html">report</A> your problem and mention this error message and the query that caused it.</h2>
<h2></h2>
</body></html>
Run Code Online (Sandbox Code Playgroud)
我检查了GAE系统状态,发现Memcache具有"调查"状态.现在在当天晚些时候,所有系统状态都是正常的,但我现在OverQuotaException从服务电话中获取:
Uncaught exception from servlet
com.google.apphosting.api.ApiProxy$OverQuotaException: The API call datastore_v3.Put() required more quota than is available.
at com.google.apphosting.runtime.ApiProxyImpl$AsyncApiFuture.success(ApiProxyImpl.java:491)
at com.google.apphosting.runtime.ApiProxyImpl$AsyncApiFuture.success(ApiProxyImpl.java:392) …Run Code Online (Sandbox Code Playgroud) 我一直在我的应用程序中使用AndroidSlidingUpPanel库.对于自23.1.1以来的Android设计支持库版本,这会破坏我的布局中的一些内容.由于最新版本引入了BottomSheetBehavior,我正在寻找替换AndroidSlidingUpPanel库并改为使用BottomSheetBehavior.但是,BottomSheetBehavior只有3个状态,隐藏,折叠和展开(以及2个中间状态拖动和稳定).AndroidSlidingUpPanel还具有锚定状态,这是面板在折叠和展开之间捕捉到的状态.我怎么能使用BottomSheetBehavior并获得这个额外的锚定状态?
例如,谷歌的地图应用就有这种行为.
隐:
折叠:
拖动(折叠和锚定之间):
锚定:
拖动(在锚定和扩展之间):
扩展:
当位置具有锚定状态时,可选图像在地图上向上滑动时会出现一些视差效果.当完全展开时,位置名称将成为操作栏标题.我最终也有兴趣实现类似的东西.
我的第一直觉是锚定状态实际上是扩展状态,在面板上方有空的空间,地图仍然可见,是视图的透明部分.然后,锚定和展开状态之间的拖动只是滚动面板视图本身的内容.
这可以通过以下事实得到验证:在锚定状态下,您可以通过滑动面板上方的可见地图区域继续向上滚动面板.视图的这个不可见部分必须在从折叠状态向上滑动的同时扩展到其区域(如可选图像可见),因为在折叠状态下无法从地图向上滑动面板.我想我可以走这条路,但想知道那里是否有更好的方法.
android android-support-library android-design-library bottom-sheet
我在 a 中有两个视图LinearLayout,这两个wrap_content视图都应该足够大以显示其内容。视图LinearLayout组应该wrap_content由两个子组组成,使其足够大以显示两个子视图的内容。
但在此之后,如果两个子视图之一较大,则另一个子视图应扩展以匹配父视图,以填充可用的剩余空间。两个子视图的内容是动态的且未知,运行时会变大。
两个子视图是 aTextView和 a Spinner。应Spinner填充宽度上的任何剩余空间LinearLayout。但如果我将 更改Spinner layout_width为match_parent且TextView不够大,则会Spinner截断其内容。
wrap_content基本上我需要一种方法来选择和之间的最大宽度match_parent。
这是布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/parentView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-2dp"
android:layout_marginBottom="-2dp"
android:paddingStart="4dp"
android:paddingEnd="4dp"
android:textSize="12sp"
android:textColor="?android:textColorHint"
tools:text="Label" />
<Spinner
android:id="@+id/spinner"
style="@style/Widget.AppCompat.Spinner.Underlined"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<!-- or android:layout_width="match_parent"? need max of both... -->
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个ListView类似于Gmail应用的应用,其中每行CheckBox左侧有一个便于通过上下文操作栏进行多项选择和操作,同时允许点击每一行转换到另一个活动.
最初,在添加CheckBox行之前,将使用我正在使用的Holo主题中的浅蓝色背景颜色来指示他们的选择,并onListItemClick在ListFragment单击时调用我,并onItemLongClick在OnItemLongClickListener长时间单击时调用.
当我CheckBox为行视图添加到我的布局.xml文件时,背景不再改变颜色,我不再接收点击或长按事件.如果我在我的视图.xml中添加android:longClickable="true"到顶部ViewGroup,那么我再次开始获得长按事件.但是android:clickable="true"没有让我点击活动.并且都不允许背景蓝色选择指示返回.CheckBox触摸时,只有自身提供蓝色背景的视觉触摸指示.
我需要做什么才能获得正常的视觉选择指示以及在视图中点击ListView行上的事件CheckBox?
这是我的观点的相关部分.xml:
<?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:longClickable="true"
android:orientation="horizontal" >
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingRight="12dp"
android:paddingTop="5dp" >
...
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 在我的Google App Engine应用程序中,我需要从数据存储区查询中获取并返回可能大量的实体,以响应服务调用GET请求.此调用可能返回数千个实体和MB的序列化数据.
响应数据包的第一部分传达序列化结果中有多少实体,然后是所有序列化实体.目前我正在迭代查询中的所有实体,QueryResultIterator最大页面大小限制,之后我返回一个光标,从中可以用来继续获取前一个调用停止的位置(如果达到最大值并且有仍导致查询).当我遍历结果时,我将它们保存在列表中.一旦我用尽了查询结果或达到最大页面大小,我就可以从该列表的大小中获取实体数量.但是我必须再次遍历此列表以序列化每个实体并将结果写入响应输出流.
我不知道这是执行此操作的最有效方法.有没有一种方法可以在实际迭代查询结果或直接将它们提取到列表中之前获取查询结果中的实体数量?(列表方法无论如何都不起作用,因为我正在使用游标,这需要使用QueryResultIterator).
QueryResultIterator有一个方法getIndexList().这是获得查询结果中实体数量的成本较低的方法吗?我假设此列表将包含查询结果中每个实体的一个索引对象.此外,我需要此列表仅包含在交互器的当前光标位置之后的实体的索引.我的理解是正确的还是这种方法不会做我想的那样?
仅加载索引的列表将比加载整个实体的列表需要更少的内存.虽然,我不知道这个列表是否会受到查询的预取或块大小的限制,或者我是否想要使用查询的limit参数,因为我只想知道有多少实体在结果最大页面大小加一(知道还有更多结果并提供光标继续).
目前我正在设置预取和块大小(到我的页面限制的大小),但我没有使用限制或偏移参数,因为我正在使用游标.根据我的理解,游标优于偏移/限制.设置limit参数是否会影响使用游标继续查询?
很明显,我有很多关于GAE数据存储查询如何工作以及它们如何受到更改参数影响的问题.所以任何见解都表示赞赏.App Engine API的文档通常很少,因为在一个句子中描述的方法几乎说明了可以从方法签名中推断出什么.否则他们通常不会详细说明.也许我现在这样做的方式毕竟还不错.它按原样工作,但我正在尝试优化服务调用,以便为我的客户端应用程序获得最佳响应时间.
更新:顺便说一句,我在我的应用程序中使用Objectify v3并执行此查询.我需要使用低级数据存储API的几个地方,包括进行地理位置查询(使用geomodel)和投影查询(在Objectify v3中不支持).因此,如果使用Objectify有一个很好的方法,那将是理想的.否则我可以使用低级API,但这种方式总是比较麻烦.
android ×5
ios ×2
java ×2
android-menu ×1
android-xml ×1
bottom-sheet ×1
checkbox ×1
class ×1
divider ×1
generics ×1
layout ×1
listview ×1
objectify ×1
robospice ×1
storyboard ×1
textview ×1
uibutton ×1
xcode ×1
xcode6 ×1