腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
1
回答
获取
ConstraintLayout
的
高度
和
宽度
android
、
android-studio
、
android-layout
、
android-constraintlayout
、
layoutparams
我想做一个根据parent
的
height
和
width计算边距值
的
方法。下面的代码同时输出height
和
width
的
-1。我如何正确地获得父级
的
高度
和
宽度
?RequiresApi(api = Build.VERSION_CODES.R) public void setMarginsPercentages(Context context, @NotNull
ConstraintLayout
double rightPerc
浏览 109
提问于2021-04-04
得票数 0
1
回答
安卓: TabLayout是如何编程设置
高度
=0
的
?
java
、
android
、
android-tablayout
这里是我
的
xml of TabLayout<android.support.constraint.
ConstraintLayout
app:layout_constraintTop_toBottomOf="@+id
浏览 1
提问于2017-11-06
得票数 0
1
回答
ConstraintLayout
中
的
中心对齐行为
android
、
android-constraintlayout
我有一个相同
的
宽度
和
高度
的
图像,这是60%
的
设备
宽度
。我希望图像
的
垂直中心是设备
高度
的
45%。我
的
代码如下: 我已经将constraintTop
和
constraintBottom设置为指南,但它就像constraintBottom不起作用一样。图像就在指南
的
底部。我不知道我
的
密码有什么问题。我试图将“'androidx.
c
浏览 4
提问于2020-12-28
得票数 2
回答已采纳
1
回答
以编程方式根据最大
宽度
(或
高度
)调整android按钮
的
大小
android
、
button
、
resize
、
height
、
width
我想要调整我以编程方式添加到Android应用程序中
的
按钮(Java代码)
的
大小。它们被添加到具有默认
宽度
和
高度
的
布局中(因为没有内容)。我希望它们调整到屏幕大小
的
1/9来填充整个屏幕(一行9个按钮来填充屏幕
宽度
)。我尝试
获取
屏幕
宽度
(或parents容器
的
宽度
,因为它适合屏幕
宽度
)。但是只有0dp。 <?> <androidx.<em
浏览 19
提问于2019-10-02
得票数 0
回答已采纳
1
回答
如何调整
ConstraintLayout
的
高度
与回收站
的
高度
?
android
、
android-recyclerview
我想有一个回收视图与未知数量
的
东西列表
和
RecyclerView下
的
一个按钮。我希望整个
ConstraintLayout
的
高度
随着我
的
RecyclerView
的
高度
而变得灵活,也就是说,如果列表很短,那么换行内容;如果列表很长,只需填满整个屏幕。现在,无论列表有多长,
ConstraintLayout
都会填满整个屏幕。我已经有了所有的wrap_content,但在底部仍然有空白。我希望我
的
按钮总是出现
浏览 2
提问于2020-08-04
得票数 0
1
回答
在ImageView中有一个
宽度
和
高度
相同
的
ConstraintLayout
imageview
、
android-imageview
、
android-constraintlayout
如何使ImageView
宽度
和
高度
等于父
ConstraintLayout
的
宽度
?所以它显示了一个全
宽度
的
正方形ImageView。 通常,一个小部件
的
设置
高度
如何等于另一个小部件
的
宽度
?
浏览 0
提问于2018-09-29
得票数 7
回答已采纳
8
回答
Android屏幕
宽度
百分比( RecyclerView项目)
android
、
android-recyclerview
、
android-constraintlayout
我如何才能让RecyclerView
的
项目
高度
达到屏幕
高度
的
30%?我不能简单地使用
ConstraintLayout
或PercentFrameLayout/PercentRelativeLayout,因为它们相对于父布局来定位子布局,它们
的
大小可能与屏幕不匹配。我最好使用纯XML (并且不必使用任何Runnables来动态
获取
屏幕
高度
)。需要澄清
的
是,由于许多解决方案都建议限制RecyclerView
的</e
浏览 165
提问于2018-07-06
得票数 45
2
回答
什么是布局_
宽度
/
高度
= wrap_content中
的
进度条
和
swith
java
、
android
、
user-interface
、
view
、
android-wrap-content
我无法理解 wrap_content for View
的
元素(比如ProgressBar、Switch、带有背景
的
原始视图-出于某种原因,它占据了屏幕上所有可用
的
位置),wrap_content
的
意思是“和您内部
的
文本一样高
和
宽”,这并不像TextView那样琐碎。<androidx.
constraintlayout
.widget.
ConstraintLayout
android:id="@+id/prog_bar_
浏览 2
提问于2020-04-14
得票数 1
回答已采纳
1
回答
在约束布局中根据设备
宽度
设置视图
高度
android
、
android-constraintlayout
这是我
的
代码及其输出:<androidx.
constraintlayout
.widget.
ConstraintLayout
xmlns:android="http://schemas.android.com/apk/reslayout_constraintStart_toStartOf="parent" app:layout_c
浏览 4
提问于2021-12-19
得票数 2
回答已采纳
4
回答
RecyclerView项
的
高度
和
宽度
动态变化
android
、
android-recyclerview
我是安卓开发
的
新手,我正在开发一个应用程序,该应用程序从服务器下载图片,并在gridView中显示它们。但当该应用程序在更大屏幕
的
手机上运行时,会出现一些额外
的
空间。这里有一些截图。我有每个项目的模型与一个固定
的
高度
和
宽度
为110dp<?xml version="1.0" encoding="utf-8"?android:adjustViewBounds="true"
浏览 0
提问于2017-03-15
得票数 22
回答已采纳
1
回答
在Android中定位视图时,约束布局是否更灵活?
android
、
android-studio
、
android-relativelayout
、
android-constraintlayout
约束
和
相对视图组都支持视图wrt
的
相对定位。相对布局提供了4个不同
的
属性: layout_toRightOf / toLeftOf / toTopOf / toBottomOf,而约束提供了格式“layout_constraintTop_toTopOf”
的
多种组合 但是,我们不能使用相对布局
的
4个属性将视图放置在任何位置吗?
浏览 1
提问于2018-02-19
得票数 0
回答已采纳
1
回答
如何在Android中设置布局
的
宽度
和
高度
?
java
、
android
、
kotlin
、
layout
我有一个
ConstraintLayout
:我试图通过代码设置它
的
宽度
和
高度
以匹配它
的
父级,如下所示:val params =
ConstraintLayout
.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT
浏览 18
提问于2022-08-17
得票数 -1
回答已采纳
7
回答
布局
宽度
等于
高度
android
、
android-layout
、
button
有没有一种方法可以让我
的
xml中
的
高度
依赖于
宽度
? 我有一些线性布局
的
按钮。按钮
的
宽度
取决于设备,因为它们水平填充整个屏幕。我想要方形
的
按钮,这就是我
的
问题。有没有人能帮我?
浏览 0
提问于2013-01-27
得票数 10
1
回答
在自定义布局类上膨胀xml-Layout
的
问题
java
、
android
、
android-layout
、
android-custom-view
我有一个自定义
的
ConstraintLayout
类(Card.java),它覆盖了onDraw()方法以在他
的
背景中绘制一个六边形。在前台,我尝试使用三个TextViews来显示三个数字。为此,我在Card
的
构造函数中膨胀了一个card.xml。将显示TextViews,但位置不正确。它们应该与卡片
的
宽度
和
高度
相匹配,然后将其自身定位到卡片
的
左上角
和
右上角,并将一个定位到卡片
的
底部。我尝试将card
浏览 66
提问于2019-03-24
得票数 1
回答已采纳
1
回答
有办法在
ConstraintLayout
中复制组件
的
约束参数吗?
java
、
android
我
的
ConstraintLayout
中有一个
ConstraintLayout
,它位于XML中。然后,在单击按钮时,我想将此视图更改为另一个视图。我已经有了脚本,它可以正常工作,但是新
的
View出现在屏幕
的
顶部,我需要它与以前
的
处于相同
的
位置。我读过Google文档,但我发现
的
任何东西似乎都帮不了我。是唯一
的
方法是通过使用ConstraintSet.connect()
浏览 1
提问于2018-12-04
得票数 2
回答已采纳
3
回答
在我
的
例子中,我
的
ScrollView底部显示了一个很大
的
空白区域
android
、
android-layout
、
android-scrollview
、
android-constraintlayout
我有一个ScrollView,里面有一个
ConstraintLayout
,在
ConstraintLayout
里面有一个RecyclerView。android:fillViewport="true" app:layout_constraintVertical
浏览 0
提问于2017-12-21
得票数 1
3
回答
改变LinearLayout
的
背景会改变它
的
宽度
和
高度
android
、
android-linearlayout
我试图将LinearLayout
的
背景更改为一些木质纹理,但它会根据木质背景
的
尺寸更改LinearLayout
的
宽度
和
高度
!我需要LinearLayout忽略背景尺寸!
浏览 1
提问于2014-11-01
得票数 2
2
回答
将图像大小从屏幕大小确定为一定百分比
android
、
android-layout
在约束布局中,如果我希望图像水平地处于中间,并且位于屏幕
的
顶部,那么我可以这样做。<android.support.constraint.
ConstraintLayout
androidlayout_constraintRight_toRightOf="parent"<
浏览 3
提问于2017-06-03
得票数 5
回答已采纳
1
回答
如何以编程方式设置
ConstraintLayout
layout_weight
android
、
kotlin
layoutParams = 但是
ConstraintLayout
ConstraintLayoutParams只有这样
的
宽度
和
高度
。
ConstraintLayout
.LayoutParams(
ConstraintLayout
.LayoutParams.MATCH_PARENT,
Cons
浏览 5
提问于2022-10-29
得票数 0
5
回答
Android view layout_width -如何以编程方式进行更改?
android
、
android-layout
这是我
的
观点,我希望将layout_width更改为"10dip“。我如何以编程
的
方式做到这一点?注意,这不是一个LinearLayout,它是一个视图。green_rectangle" android:layout_width="50dp"/> 我知道LayoutParams
的
事如何使用它将
宽度
设置为10dip?
浏览 4
提问于2012-04-15
得票数 74
回答已采纳
点击加载更多
相关
资讯
织梦dedecms编辑器上传图片怎么去掉宽度和高度限制
如何获取Unity导航系统中某点的高度
奇葩思路获取各大平台Vip资源,思维决定python爬虫的应用高度!
为什么有宽度的多段线和标注斜线会显示空心?
爬虫两种遍历策略的py实现:宽度优先和深度优先
热门
标签
更多标签
云服务器
ICP备案
实时音视频
对象存储
即时通信 IM
活动推荐
运营活动
广告
关闭
领券