问题标签 [android-relativelayout]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
375 浏览

android - 在视图之间滚动

我目前正在为安卓开发一款游戏。

我有三个彼此相邻的 ImageView,它们使用“android:layout_toRightOf”彼此相邻定位。这些视图位于 RelativeLayout 标记内。这些视图中的每一个都使用“android:scaleType="fitCenter"" 居中于屏幕中间,并填满整个屏幕。

我正在尝试实现从一个视图到另一个视图的水平滚动,这样我基本上一次只能在屏幕上看到一个视图。

这是我目前正在使用的代码

我目前得到的是三个彼此相邻的图像——但有时它们占据的空间不到整个屏幕。我希望左右填充都是正确的,这样我一次只能看到一个图像。

有任何想法吗?

0 投票
1 回答
1629 浏览

android - 动画背景图像

我有一个带有平铺背景的 RelativeLayout。有没有办法制作补间动画以淡出现有图像并淡入新图像?

0 投票
2 回答
1819 浏览

android - 如何在 Java 代码中更改嵌套布局的子视图组的宽度?

我有一个线性布局的布局 xml 文件。其中一个孩子又是一个 ViewGroup 相对布局。在我的 java 代码中,我想根据我的要求更改这个子视图组的宽度。我试过这个

我不能这样做,因为 findViewById(childViewGroup) 不获取 ViewGroups 它只为 Views 做。

注意:我不能为这个小要求定义一个全新的 layout.xml,因为它是一个巨大的布局文件,可能会导致性能开销。我只想在我的 java 活动代码中更改子视图组的宽度。

在此先感谢您的帮助。

0 投票
2 回答
10322 浏览

android - 在 RelativeLayout 的子视图上设置参数

我无法准确找到我需要用来在相对布局的子视图上设置参数的语法。我有一个根相对布局,我想像这样将 2 个子文本视图彼此相邻设置

所以我有

如何设置相对对齐?

0 投票
3 回答
25304 浏览

android - 在线性布局中嵌套相对布局

我的 layout.xml 中有以下代码。

在 eclipse 插件布局创建器中,EditText 和按钮正确显示。(见下面的截图)

替代文字

但在设备和模拟器上,该按钮并未隐藏。(见下面的截图)

替代文字

知道为什么按钮会隐藏在设备中吗?

0 投票
2 回答
1827 浏览

android - 使用 RelativeLayout 在 ListView 中重复 RatingBar 不稳定

这是 ListView 中一行的一些 xml:

结果如下: 替代文字

(这是一个普通的甜甜圈 1.6)。

我想要实现的是左侧的封面,右侧是标题、评级栏和可选的贷款状态。如您所见,RatingBar 不断重复(它应该只有五颗星);并且只要设置了贷款状态,标题就会消失。如何修复我的 XML 以达到我想要的效果?

0 投票
1 回答
2748 浏览

android - Problem adding textboxes dynamiclly in a relative layout

I am having trouble dynamically adding a text box to my view. More specifically, the text-box-adder works, but the button I am trying to move below it does not. The original view is the first picture in the below hyperlink.

After the +/- button is pressed, it should add a text box between the second text box and the decide button, and then move the +/- button down so it is next to the new box. Instead, the second picture happens:

http://i.stack.imgur.com/mzBL3.png

My code looks like this:

#xA;

Numboxes is just a counter so I can keep track of the boxes and name them accordingly, and bottomView is just the bottom-most text box.

I have searched all over the android development pages, and tried creating the new layout params. I also tried replacing the decide button with a text box, bu the same problem occurred. Please help.

0 投票
3 回答
132420 浏览

android - Android RelativeLayout 以编程方式设置“centerInParent”

我有一个这样的相对布局

我希望能够以编程方式设置与positiveButton以下相同的效果:

我怎样才能以编程方式做到这一点?

0 投票
1 回答
7651 浏览

android - RelativeLayout 中的填充问题

我有这个ViewRelativeLayout并且该android:paddingTop属性似乎不起作用。尝试了各种值,但视图仍然靠近“计算”按钮。

0 投票
6 回答
25598 浏览

android - 在“顶栏”和“底栏”之间使用 ListView 的 Android 布局

我正在尝试构建一个布局,其中屏幕顶部有一个文本视图,屏幕底部有一个底栏。这些视图中的每一个都应该保持固定,并且在这两个视图之间应该是一个 ListView。

我的布局(见下文)几乎可以正常工作:顶部和底部组件保持固定,列表视图滚动。“问题”是我的 ListView 的最后一行仍然隐藏在底栏后面。

有关如何调整布局的任何建议?

谢谢!