android-framelayout 相关问题

Android布局,使用屏幕显示可以堆叠在一起的视图,最新的子项添加在顶部。

Android ImageButton 和 TextView 在 Framelayout 中的索引位置

我有一排 3 个 ImageButtons 包裹在 LinearLayout 中。 然后将每个ImageButton封装在一个FrameLayout中: 我有一排 3 个 ImageButtons 包裹在 LinearLayout 中。 然后将每个ImageButton封装在一个FrameLayout中: <FrameLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_weight="1"> <ImageButton android:layout_width="wrap_content" android:layout_margin="5dp" android:layout_height="wrap_content" android:adjustViewBounds="true" android:scaleType="centerInside" android:src="@drawable/btn1" android:background="@null" android:foreground="?android:attr/selectableItemBackground" /> <TextView android:layout_width="35dp" android:layout_height="35dp" android:text="1" android:textSize="12sp" android:textColor="#ffffff" android:padding="10dp" android:layout_gravity="top|right" android:background="@drawable/smallcircle"/> </FrameLayout> 在每个 ImageView 上,我希望在右上角有一个带有圆形背景的小数字。这工作得很好,但我无法将文本置于圆圈中心。 如果我有文字,例如15,看起来是居中的,但是当数字只有1的时候,它并不在中心。 我无法在 TextView 中使用中心,因为已经有一个布局重力将带有圆圈的数字移动到右上角。 圆圈背景: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <size android:width="35dp" android:height="35dp" /> <solid android:color="#4CAF50" /> </shape> 示例: 嗯,Android Studio 根本没有在 TextView 中自动建议我 android:gravity,但是当我手动添加它时,它就完成了。因此 android:layout_gravity 移动到正确位置,android:gravity 使文本居中。 简单:)

回答 1 投票 0

如何在 AOSP 13 中映射另一个键码以进行后退导航?

我正在使用 AOSP 13 源代码。 通过 adb shell 返回 adb shell 输入按键事件 4 4是返回的关键代码 我想通过键码 141 映射返回导航,以便我可以使用上面的命令进行返回...

回答 1 投票 0

画中画 RTL 布局中 FrameLayout 内的自定义视图问题

我有一个全屏 FrameLayout,其中包含我在运行时添加的四个视图: 重复(4){我-> val view = View(this).apply { 设置背景颜色(颜色[i]) } 视图 += 视图...

回答 0 投票 0

android setVisibility不工作 FrameLayout, LinearLayout [关闭]

问题是驱动程序信息不显示!!!我把setvisiblity(view.visible)和setvisiblity(view.invisible)任何解决办法。

回答 1 投票 0

Android Studio 3.6.1 当我用自动完成功能钩住框架布局时出现错误。

你好,我只是想从一个片段切换到另一个使用按钮。没有什么困难的......代码工作良好,但我已经花了很多时间,因为Android去错误,如果我挂钩frameLayout ...

回答 1 投票 0

scrollView在framelayout内部不起作用

我的scrollview在framelayout中不起作用,这是我的代码,我尝试了很多有关尺寸的问题,但是问题不在于尺寸,这是我不知道的其他问题,请帮助:我也尝试过相同的方法...

回答 1 投票 0

FrameLayout不适合屏幕

因此,我正在开发一个使用FrameLayout作为片段容器的应用程序,其内容取决于底部导航器中的选定项目。我的问题是,由于某种原因,我无法获得...

回答 1 投票 0

RecyclerView流过屏幕

我有一个替换FrameLayout的片段。在此片段中,如果只有RecyclerView,则可以将其高度设置为match_parent,并且一切正常。但是,如果我有多个元素...

回答 1 投票 0

背景模糊,仅在Android中使用XML

我正在将FrameLayout用于不同的布局层。这是我的代码: //一些视图和视图组

回答 1 投票 0

Android:是否可以将字符串类型的变量应用于findViewById?

我有一个称为Framelayouts_monday的FrameLayout变量的数组类型。我将变量声明为framelayouts_monday = new FrameLayout [24]我想减少代码,以便声明...

回答 1 投票 -1

Andorid recyclerview:以片段的垂直方向显示图像不起作用

我正在尝试使用LinearLayout Recyclerview在n个android片段中垂直显示图像列表。 fragment_list.xml ] >>

回答 1 投票 0

用片段替换Activity中的FrameLayout不会替换整个FrameLayout

我将简要介绍我的应用布局。有一个Activity,它的内部是一个包装有RelativeLayout的FrameLayout(此Relative Layout中也有一些其他小部件),其...

回答 1 投票 0

无法使用“ FrameLayout”,错误:“必须声明元素FrameLayout” [Android Studio]

我正在React Native项目上进行一小部分Android开发,但我不知道如何“导入” FrameLayout。我敢肯定这很简单,但是经过一个小时的谷歌搜索,我感到很沮丧。 ...

回答 1 投票 0

将RecyclerView添加到布局后,按钮不再可单击

在将RecyclerView添加到我的布局之前,我已经能够单击已编程为能够单击的“ TextView”(android:id =“ @ + id / how_is_your_day_question”)。我添加完...

回答 1 投票 0


FrameLayout类的子类不会重新绘制画布屏幕吗?

[当我使用FrameLayout类(GameView)使用addView(object)以便可以使用ontouchlistener()时,它仅绘制Rocket和Shooter(用于绘制的类,都在GameView中调用),但是它...] >

回答 1 投票 0

框架布局未在ConstraintLayout内正确定位

我将一个FrameLayout放在ConstraintLayout内,我认为它受到了适当的约束。但是在应用程序中,它的位置不正确。在运行时将FrameLayout替换为适当的片段。 ...

回答 3 投票 0

BadgeDrawable是否不适用于FrameLayout中的视图,例如按钮,图像,文本视图等?

我在不显示徽章的主要活动中具有此功能:私人乐趣setFindShiftBadge(state:HomeState){val findShiftsBadge = BadgeDrawable.create(this)...

回答 1 投票 1

FrameLayout的目的?

我为FrameLayout找到的所有示例都使用FrameLayout将多个子级堆叠在一起。甚至这里的Stackoverflow答案说,您使用FrameLayout在顶部堆叠子视图...

回答 1 投票 -2

调整两个frameLayout的大小,每个包含一个片段,并在调整大小时调整其中一个frameLayout项的大小

我想制作一个Android音乐播放器。在MainActivity中,我有两个FrameLayout并将两个不同的Fragment推入每个。然后一个用于homeFragment,另一个用于MusicPlayerFragment。 ...

回答 1 投票 1

© www.soinside.com 2019 - 2024. All rights reserved.