草庐IT

attributeSet

全部标签

android - AttributeSet 值返回 @2131296269 - 它是什么以及如何使用?

如果我在xml中定义一些View,例如:然后在初始化时使用AttributeSet:publicAlphabetButton(Contextcontext,AttributeSetattrs){super(context,attrs);if(attrs!=null){StringtextSizeAttribute=attrs.getAttributeValue("http://schemas.android.com/apk/res/android","textSize");这个textSizeAttribute值是这样的:05-0116:00:21.154:I/AlphabetButt

在 Java 的 TextArea 中使用文档监听器时出现 java.lang.IllegalStateException

DocumentListenerdl=newMessageDocumentListener();((AbstractDocument)nboxArea.getDocument()).setDocumentFilter(newDocumentFilter(){publicvoidinsertString(FilterBypassfb,intoffset,Stringstring,AttributeSetattr)throwsBadLocationException{string=string.replaceAll("\t","");super.insertString(fb,offset

android - 如何在 Android 中创建一个 AttributeSet?

我正在尝试在Android中编写一些代码以在attrs.xml文件的AttributeSet中设置参数。但是我收到“找不到资源”错误。Java代码MainActivity.javapackagecom.example.mycompoundbutton;importorg.xmlpull.v1.XmlPullParser;importandroid.os.Bundle;importandroid.util.AttributeSet;importandroid.util.Xml;importandroid.app.Activity;importandroid.content.res.Res

Android - 属性集

我有这样的代码:publicclassCannonViewextendsSurfaceViewimplementsSurfaceHolder.Callback{Activityactivity;及其构造函数:publicCannonView(Contextcontext,AttributeSetattrs){Super(context,attrs)activity=(Activity)context;但显然AttributeSet什么也没做,我不知道为什么会在那里,所以我的问题是:1.-什么是AttributeSet?2.-为什么我们需要提供AttributeSet属性作为第二个参数?

android - 我无法从我的 XML 资源中读取 AttributeSet

我正在尝试从XML资源文件中读取AttributeSet。相关代码如下://ThishappensinsideanActivityResourcesr=getResources();XmlResourceParserparser=r.getXml(R.layout.testcameraoverlay);AttributeSetas=Xml.asAttributeSet(parser);intcount=as.getAttributeCount();//countis0!!??count==0,所以Android根本没有读取任何属性!XML文件(R.layout.testcameraov

ios - 使用核心数据时更新 Spotlight 搜索索引?

我有一个应用程序使用CoreSpotlight来索引应用程序内容。该应用程序还使用CoreData,当创建NSManagedObject时,对象的详细信息用于CSSearchableItem然后添加到Spotlight搜索索引。我的印象是没有对NSManagedObject和CSSearchableItem的方向引用,所以当将项目添加到索引时,它只是复制细节。这里是一个添加项目到索引的例子。//SpotlightIndexSearch//Createanattributesettodescribeanitem.letattributeSet=CSSearchableItemAttrib

ios - 使用核心数据时更新 Spotlight 搜索索引?

我有一个应用程序使用CoreSpotlight来索引应用程序内容。该应用程序还使用CoreData,当创建NSManagedObject时,对象的详细信息用于CSSearchableItem然后添加到Spotlight搜索索引。我的印象是没有对NSManagedObject和CSSearchableItem的方向引用,所以当将项目添加到索引时,它只是复制细节。这里是一个添加项目到索引的例子。//SpotlightIndexSearch//Createanattributesettodescribeanitem.letattributeSet=CSSearchableItemAttrib

android - 如何从 style.xml 创建 AttributeSet?

这是我的故事:我有一个自定义ViewGroup,我想使用预定义样式从代码创建,到目前为止,我的方法是从style.xml元素创建一个AttributeSet对象,就像这样(警告,小心前面的复制粘贴代码):XmlPullParserparser=getResources().getXml(R.style.my_stylez);AttributeSetattributes=Xml.asAttributeSet(parser);但是这样做时我会遇到一些疯狂的错误:“..android.content.res.Resources$NotFoundException:资源ID#0x7f09000

android - 如何从 style.xml 创建 AttributeSet?

这是我的故事:我有一个自定义ViewGroup,我想使用预定义样式从代码创建,到目前为止,我的方法是从style.xml元素创建一个AttributeSet对象,就像这样(警告,小心前面的复制粘贴代码):XmlPullParserparser=getResources().getXml(R.style.my_stylez);AttributeSetattributes=Xml.asAttributeSet(parser);但是这样做时我会遇到一些疯狂的错误:“..android.content.res.Resources$NotFoundException:资源ID#0x7f09000

android - 在android中以编程方式创建 View 时如何传递AttributeSet

然后我像水平View一样以编程方式创建,如何以编程方式传递AttributeSet。我的构造函数如下所示:publicHorizontalListView(Contextcontext,AttributeSetattrs){super(context,attrs);}我试过这个:mHlvSimpleList=newHorizontalListView(mcontext,R.style.niceview);错误:TheconstructorHorizontalListView(Context,int)isundefined在style.xml中wrap_contentwrap_conte