草庐IT

Content-Based

全部标签

android - "requestFeature() must be called before adding content"主从模板

我使用主详细信息模板启动了一个新应用。当我在我的平板电脑上试用该应用程序时,使用双Pane布局,当我改变平板电脑的方向时,它会崩溃,标题中出现异常。仅当详细信息fragment有内容时才会发生这种情况。崩溃发生在super.onCreate行,我什至没有调用requestFeature,所以它甚至不是我的代码:@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_item_list);if(f

Android 仅显示带有 ACTION_GET_CONTENT 的 mp3

我试图只显示MP3文件:Intentintent=newIntent(Intent.ACTION_GET_CONTENT);intent.setType("audio/mp3");startActivityForResult(Intent.createChooser(intent,"MusicFile"),FIND_MUSIC);但它最终也列出了*.3gp文件。如何限制为仅*.mp3文件?我已经尝试过setType("mp3"),但Intent无法找到任何加载该文件的应用。 最佳答案 您需要传递给setType以仅显示mp3文件的正

android - Xamarin - ‘Android.Content.IntentFilter' 不是属性类

我创建了一个包含广播接收器实现的Android类库:[IntentFilter(newstring[]{"com.google.android.gcm.intent.RETRY"},Categories=newstring[]{"@PACKAGE_NAME@"})]publicclassGcmBroadcastReceiver:BroadcastReceiver{publicGcmBroadcastReceiver(){}}当我尝试构建时收到消息“'Android.Content.IntentFilter'不是属性类”我需要做什么来构建这个版本? 最佳答案

java - android.content.res.Resources$NotFoundException 异常

@OverridepublicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.screenlocked);//RetrievestoredIDfinalStringSTORAGE="Storage";SharedPreferencesunique=getSharedPreferences(STORAGE,0);LoginID=unique.getString("identifier","");//Retrievestoredphonenum

android - 如何设置 Header 、 Scrollable content 和 Footer ?在安卓系统中

我想让中间部分可以滚动。我不知道..这是我的xml大纲。我想在可滚动区域中插入此xml大纲。注意:页眉和页脚必须保持不变。只有中间区域必须滚动 最佳答案 更简单的方法是使用: 关于android-如何设置Header、Scrollablecontent和Footer?在安卓系统中,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/13938092/

java - 错误 : String types not allowed (at 'layout_height' with value 'wrap content' ). activity_main.xml

我是论坛的新手,刚开始学习Android应用程序开发。我正在阅读developer.android.com上的教程并且已经遇到编译错误。我在我的activity_main.xml中看到了这三个错误:error:Error:Stringtypesnotallowed(at'layout_height'withvalue'wrapcontent').activity_main.xmlerror:Error:Stringtypesnotallowed(at'layout_width'withvalue'wrapcontent').activity_main.xmlerror:Error:St

安卓.content.res.Resources$NotFoundException : String resource ID #0x12 - onLocationChanged()

我的代码://GeolocationActivity.java@OverridepublicvoidonLocationChanged(Locationarg0){if(gpson&&arg0!=null){tv1.setText((int)arg0.getLongitude());//thereisanerrortv2.setText((int)arg0.getLatitude());tv3.setText((int)arg0.getAccuracy());}}privatevoidsetUpGPS(){if(locman.isProviderEnabled(LocationMana

java - 使用 android.content.Context.checkPermission 检查权限时出现空指针异常

在查询Android日历中的事件之前,我需要检查权限。为此,AndroidStudio警告我需要在查询之前进行检查。自动生成的代码是这样的:if(ActivityCompat.checkSelfPermission(this,Manifest.permission.READ_CALENDAR)!=PackageManager.PERMISSION_GRANTED){System.out.println("NOACCESSTOCALENDAR!!Abortmission,abortmission!!");}当尝试运行它时,出现此错误:Attempttoinvokevirtualmetho

java - 如何获取可见性消失的 View 的高度以及在 xml 中定义为 wrap_content 的高度?

我有一个visibility=gone和height=wrap_content的ListView,我需要它的高度才能制作展开动画。我已经试过了:view.measure(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);intheight=view.getMeasuredHeight();和v.measure(View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED),View.MeasureSpec.makeMeasur

android - goneMargin 在 wrap_content ConstraintLayout 中不受尊重?

我有一个ConstraintLayout,它的高度是wrap_content。我希望它的高度能够根据其子项的高度折叠或展开。足够简单和常见了吧?现在我的布局如下所示:(首先,请忽略底部不正常的超大边距,可以看到,边距只有16dp,但预览渲染的边距非常大。)我的问题是,如果大矩形的可见性设置为gone,根据ConstraintLayout的文档,如果我将其goneMarginTop设置为某个值,即使它的可见性gone也会保留该边距。这样我的RequestDate就会在parent的底部有一些空间。但是,这并没有像预期的那样工作。RequestDate贴在其父项的底部:(这又是一个损坏的预