草庐IT

test_wrap

全部标签

android - 如果设置 layout_height = wrap_content,ViewPager 不工作

我在使用ViewPaper时遇到问题。当我设置ViewPaper的height=wrap_content时它没有显示任何内容,如果我为ViewPager设置高度它会显示(例如:android:layout_height="350dp")。请帮忙!谢谢!这是我的xml代码:已解决:我点击此链接,它帮助我解决了这个问题。https://stackoverflow.com/a/24666987/1928560 最佳答案 必须指定ViewPager高度match_parent或者您必须为其指定一个值。两种解决方案,在LinearLayout

Android Test Orchestrator 不适用于 Android X

我最近将我的项目迁移到使用AndroidX,并使用以下文档为我在gradle上的espresso测试配置了测试协调器:https://developer.android.com/training/testing/junit-runner#using-android-test-orchestrator我有依赖:androidTestUtil'androidx.test:orchestrator:1.1.0-beta01'但是,我的测试都没有执行,看起来它们在运行gradle时运行以下adbshell命令时失败,即:adbshell'CLASSPATH=$(pmpathandroid.su

android - 这个 LinearLayout 应该使用 android :layout_height ="wrap_content"?

我有以下xml布局:hereIgettheerror.android:orientation="vertical">但我收到了lint消息:ThisLinearLayoutshoulduseandroid:layout_height="wrap_content"为什么我会收到这条消息? 最佳答案 LinearLayout设计用于并排或堆叠元素。我的猜测是,由于ScrollView,此lint警告建议使用虚拟堆叠Documentation:“LinearLayout的所有子项都一个接一个地堆叠,因此垂直列表每行只有一个子项,无论它们有

Android Textview Italic 和 wrap_contents

我正在使用3个不同颜色的斜体TextView我想知道每个最后一个字符都没有正确显示,特别是中间显示的名字是“DanBuckland”,它缺少最后一个字符,看起来像“DanBucklano”请告诉我如何让textview斜体和粗体都..alttexthttp://www.freeimagehosting.net/uploads/953d573113.jpg 最佳答案 我遇到了完全相同的问题。我通过简单地在任何需要斜体的字符串末尾添加一个空格来解决这个问题。这可能不是最长期正确的解决方案,但它对我有用。

android - 当我使用 android.test.purchased 进行购买时,Google Play 服务停止工作

BundlebuyIntentBundle=inappService.getBuyIntent(3,this.getPackageName(),"android.test.purchased","inapp","myUserId");intresponseCode=buyIntentBundle.getInt("RESPONSE_CODE");if(responseCode==0){PendingIntentpendingIntent=buyIntentBundle.getParcelable("BUY_INTENT");this.startIntentSenderForResult(

android - ListView 的高度填满整个屏幕,尽管设置为 wrap_content

我在LinearLayout中有这个ListView:...列表由SimpleCursorAdapter以编程方式填充:adapter=newSimpleCursorAdapter(this,R.layout.list_row_search,mCursor,from,to);list_row_search有一个带有两个TableRow的TableLayout:现在当列表被填充时,ListView占据了空屏幕,即使在数据库中只找到一个元素。eclipse中的HierarchyView显示得很清楚,ListView是填满屏幕的View。你能告诉我问题出在哪里吗?感谢您的宝贵时间!

android - Gradle : No tests found

当我尝试通过执行来运行Android测试时:./gradlewconnectedDebugAndroidTest出现以下错误:com.android.builder.testing.ConnectedDevice>Notestsfound.[devicename]FAILEDNotestsfound.Thisusuallymeansthatyourtestclassesarenotintheformthatyourtestrunnerexpects(e.g.don'tinheritfromTestCaseorlack@Testannotations).:connectedDebugAn

android - 错误 : Android-XML:Placing a <WebView> in a parent element that uses a wrap_content size can lead to subtle bugs; use match_parent

我是Android初学者,正在构建一个线性布局,但在这样的布局XML文件中出现错误,错误Placingainaparentelementthatusesawrap_contentsizecanleadtosubtlebugs;usematch_parent这部分代码显示错误这是我的XML文件的完整代码谁能告诉我我的代码有什么问题以及如何消除错误?我认为这可能是一个非常基本的问题,但我尝试过但无法弄清楚。详细信息:API级别:API19:Android4.2.2 最佳答案 与大多数答案暗示的相反,这不是Eclipse中的错误。Andr

android - 多行 TextView 的 wrap_content 宽度

我有一个TextView,其宽度和高度都设置为wrap_content,max_lines设置为2。当文本适合一行时,一切正常。但是当它换行到第二行时,TextView的宽度会变得尽可能大(它会填满父容器)。所以,我想要的是:|SomeLong||Text|我得到的是:|SomeLong||Text| 最佳答案 尝试设置TextView的最大宽度。我认为当您设置宽度wrap_content并且它移动到下一行时,这意味着宽度处于最大值(因此它填充了父容器)。所以我想当你设置最大宽度时,一旦达到这个宽度就必须转到下一行。android:

android - marginTop 不适用于 ConstraintLayout 和 wrap_content

在我的Fragment中,我有一个带有layout_height="wrap_content"的ConstraintLayout,我希望在View底部的两个按钮之间有一个边距。当我将此边距作为layout_marginBottom添加到上方按钮(button_welcome_signup)时,它似乎工作正常。但是,如果我尝试将它添加到底部按钮(button_welcome_signin)作为layout_marginTop它不起作用。有人知道这里的问题是什么/如果我做错了什么吗?(请注意,我使用wrap_content是有原因的,而且我非常想在底部按钮上使用边距,因此我可以为其样式添加