腾讯云
开发者社区
文档
建议反馈
控制台
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
登录/注册
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
视频
沙龙
1
回答
将左对齐到最长的TextView TextViews对齐,在LinearLayout中不使用包装内容。
android
、
android-layout
、
textview
、
android-linearlayout
、
android-constraintlayout
我想要创建一个布局,其中有不同长度的文本多行。所有的文字都是中心的。居中最长文本的起点将作为基础。然后,其他较短的文本将不再居中,而是左对齐到最长文本的起始点。 为了在ConstraintLayout中实现这一点,我创建了一个居中且宽度为wrap_content的LinearLayout。然后,在LinearLayout中,我有多个具有宽度wrap_content的TextViews。我期望LinearLayout自己展开(在宽度上),直到ConstraintLayout的宽度(它有设备的宽度),以确保它的子TextViews不会包装,除非文本比屏幕宽度更长(在我的特殊情况下,这是不可能的)。
浏览 2
提问于2020-06-23
得票数 1
回答已采纳
1
回答
包含合并标记的ConstraintLayout不起作用
android
、
android-studio
、
android-layout
、
android-constraintlayout
这是我的qff_layout.xml文件 <merge xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <androidx.constraintlayout.widget.ConstraintLayout andro
浏览 0
提问于2019-09-09
得票数 0
1
回答
不同语言中的Android文本具有不同的高度。
android
、
android-layout
、
fonts
、
textview
我们在应用程序中显示了一些文本(比如在带有RecyclerView的GridLayoutManager中)。该文本以不同的语言显示,如下图所示。因此,TextView的高度是不同的,因为不同的语言字体占用不同的间距。请参考下面的示例图像和绘制文本视图所需的代码。 <com.google.android.material.textview.MaterialTextView android:id="@+id/tv_title_one" android:layout_width="0dp"
浏览 4
提问于2021-10-13
得票数 0
回答已采纳
1
回答
ConstraintWidth_percent在设计选项卡和实践中看起来都不一样
android
、
android-layout
、
android-xml
、
android-constraintlayout
我正在尝试在我的shop_list_item.xml中使用ConstraintWidth_percent,它在我的商店适配器中使用。我遇到的问题是,设计标签(应该是什么样子)和应用内设计(怎么看)是完全不同的。我在这里做错了什么? 它应该是什么样子 ? 它看起来怎么样 ? 代码 <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content"&
浏览 18
提问于2021-01-11
得票数 1
回答已采纳
1
回答
为什么scrollView中的RecyclerView是不可见的?
java
、
android
、
kotlin
我有个kotlin应用。我试过NestedScrollView了。我没有任何想法。这是我的ScrollView: <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_paren
浏览 0
提问于2021-05-06
得票数 0
2
回答
如何设置Android CardView的半透明背景色?
android
、
android-cardview
、
cardview
我想将卡片视图的backgroundColor设置为argb颜色。但是结果是这样的: <androidx.cardview.widget.CardView android:id="@+id/infoCard" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:
浏览 0
提问于2020-04-09
得票数 0
1
回答
我的导航抽屉选择的项目没有完全覆盖整个菜单区域
java
、
android
、
material-design
、
navigation-drawer
我正在用材料导航抽屉做导航抽屉。我已经应用了"onNavigationItemSelected"方法,菜单正在被选择,但它只覆盖菜单的中间区域,在顶部和底部离开区域。我希望所选的菜单覆盖整个区域,就像它应该的那样。但是我得到了以下结果 我试图改变所选项目的颜色,但到目前为止没有运气。 下面是我正在做的事情的代码: XML布局: <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:a
浏览 5
提问于2020-01-20
得票数 1
回答已采纳
1
回答
Java SwipeRefreshLayout ListView隐藏了最后一个结果
java
、
android
、
listview
、
fragment
、
swiperefreshlayout
为什么我的最后一行隐藏在listview中?你好,为什么我的最后一行隐藏在listview中?你好,为什么我的最后一行隐藏在listview中? 我已经修改了1000次xml代码,但仍然无法修复它。 SwipeRefreshLayout工作得很好。 fragment_list.xml ` <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" and
浏览 10
提问于2022-11-25
得票数 1
1
回答
使用ConstraintLayout,如TableLayout或LinearLayout水平
android
、
android-linearlayout
、
android-constraintlayout
、
android-tablelayout
、
tablerow
我以表视图的方式显示数据,但是使用TableLayout (从LinearLayout继承)太重了,而且当我在一个片段中显示大量表时,会跳过帧。我担心的是,我希望第二列占据尽可能多的空间,因为这是动态数据显示的地方,但我不知道如何在ConstraintLayout中这样做。 <?xml version="1.0" encoding="utf-8"?> <com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.
浏览 8
提问于2022-04-30
得票数 1
2
回答
删除下拉项的顶部和底部背景颜色
android
、
xml
、
android-layout
我有TextInputLayout,其中我使用文本自动完成,并实现了一个性别下拉菜单。问题是,在下拉式项目的背景中,白色显示在顶部和底部。我已经给了背景颜色黄色。 ? 这是我的XML <com.google.android.material.textfield.TextInputLayout android:id="@+id/textInputLayoutGender" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDrop
浏览 28
提问于2021-06-22
得票数 0
回答已采纳
3
回答
如何使用ScrollView和线性布局使布局的一部分可滚动?
android
、
android-linearlayout
、
android-scrollview
、
scrollable
我有一个layout.xml,它分为两个部分,其中一个部分包括垂直填充的字段,另一个部分(初始部分)包括3个将被imageView填充的纸板视图(稍后),但是,当试图只让卡视图水平滚动时,什么都不会发生,唯一发生的事情是整个布局都是垂直滚动的,但没有任何硬视图水平滚动。 .xml存档代码: <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
浏览 3
提问于2020-05-12
得票数 0
回答已采纳
2
回答
ConstraintLayout不能与Android中的其他类一起实例化
android
、
android-studio
、
android-gradle-plugin
、
android-constraintlayout
、
material-components-android
有些类没有在我的预览中呈现(它们只是显示一个带有类名的灰色矩形)。我认为在我使用的库的版本中存在一些不兼容的地方。这是我的XML布局。 <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://s
浏览 4
提问于2020-07-20
得票数 3
2
回答
如何修复不同新闻部上的动画?
android
、
user-interface
、
dpi
我有一个动画,它将png图像移到顶部,然后在一定位置停止。 问题是它停留在不同的位置,在不同的设备上,有不同的DPI。 项目结构 项目链接: XML: bganim.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator
浏览 0
提问于2019-07-08
得票数 0
回答已采纳
2
回答
如何创建响应性布局?
android
、
android-layout
、
android-constraintlayout
、
android-cardview
我正在尝试创建一个登录布局。 预览手机5.0“看起来不错: 如果我在设备6.0中运行“看起来不错。但是,设备5.0”我看到的是非常大的 <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/
浏览 1
提问于2020-02-27
得票数 2
回答已采纳
1
回答
约束布局中的两个TextViews水平对齐
android-constraintlayout
地狱! 我目前正在学习os JAVA的基础知识,我不太清楚.我想要做的是:在一个TextViews中水平地对齐两个CardView,同时保持它们相互对立。 我试过的是: 分别对它们进行约束,这在我不想要的两个TextViews之间创造了空间。也玩过连锁游戏,但没能完全发挥作用(我做错了,我尝试搜索这个论坛,但只能找到我不适合(相对布局和其他布局)的非常大的问题。 安卓编辑器的图片:粉红圈是我遇到麻烦的地方(中间空间太大) 到目前为止,我想出的代码是:-) FYI:我在跟踪Android的基本功能:用户界面,这很有趣,这对他们来说似乎太先进了,但是我很想学习! <androidx.cons
浏览 0
提问于2020-07-15
得票数 1
回答已采纳
2
回答
为什么我的布局不能很好地填充在小屏幕上?
android
、
android-layout
、
android-constraintlayout
、
android-button
、
android-textinputlayout
我不知道为什么不按屏幕大小缩小按钮,因为我使用了ConstraintLayout。每当我使用4“大小的屏幕时,它就不太适合。同时,随着appcompat:1.1.0的更新,TextInputLayout得到了额外的填充。我不知道如何修复它。下面是我的代码: <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/an
浏览 3
提问于2020-07-03
得票数 1
1
回答
我可以使用布局的“顶部”FloatingActionButton吗?所以它是重叠的所有形式?
android
、
android-layout
、
floating-action-button
、
android-coordinatorlayout
我有一个带有几个编辑文本的滚动视图的.xml样式代码,我需要一个浮动按钮,在屏幕的整个滚动过程中占据整个屏幕,但是我没有找到将它插入到我的.xml中的方法,我尝试使用协调器布局,但是这个按钮没有显示在预览中。 .xml样式屏幕代码: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schema
浏览 0
提问于2020-05-21
得票数 0
1
回答
Android Scrollview内部约束布局不起作用。我该怎么解决这个问题?
android
、
android-linearlayout
、
android-constraintlayout
、
android-scrollview
、
constraintlayout-guideline
在约束布局中添加滚动视图不起作用。有人能帮我解决这个问题吗?这是供您参考的布局。即使在滚动视图中有一个子线性布局之后,也不能工作。它与工具栏重叠。他们还使用了约束布局准则,这有点让人费解。请帮帮我。 <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="htt
浏览 5
提问于2022-07-11
得票数 0
2
回答
我的(特定的)布局导致Android布局预览继续加载而不显示预览
android
、
android-studio
、
android-layout
、
android-cardview
我正在做一个布局,其中包含CardView和嵌套的线性布局。当我第一次做布局时,它工作得很好,预览窗口也显示了更改。当我打开android的一天之后,预览窗口一直在说“等待构建完成”。因此,我认为这是与IDE相关的bug。 我尝试了这里推荐的所有解决方案: ProjectRebuild使缓存失效&重新启动删除Gradle中的缓存文件夹 但是我发现问题是关于,我的布局,,因为我删除了布局,重建了项目,并且预览工作再次良好。现在我试着重新做同样的布局从一开始,但它仍然再次发生。这对我来说很奇怪,因为我的布局很简单,我以前做过类似的布局,没有任何问题。我正在使用最新的Api版本29,使用最新
浏览 4
提问于2020-01-17
得票数 1
1
回答
如何在视图内部以编程方式添加硬视图,但使用xml声明的布局?
java
、
android
、
xml
、
onclick
如何在Linearlayout中添加硬视图,以及如何访问该视图中的文本视图来更新值?很长一段时间以来,我还没有找到解决办法。谢谢 这是fragment_sub_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layou
浏览 4
提问于2020-05-05
得票数 0
回答已采纳
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
Python读取安卓手机GPS信息
拥抱安卓,微软“止损”
“鸿蒙之父”王成录再次发声:鸿蒙OS不是安卓,领先了全球所有操作系统
谷歌官方突然决定,苹果猝不及防,安卓系统将迎来“大换血”
微信7.0安卓版,给刘海屏手机“剃”了个头;9.9元秒iPhone XS致拼多多服务器宕机:官方回应
热门
标签
更多标签
活动推荐
运营活动
广告
关闭
领券