android-layout 相关问题

布局定义用户界面的可视结构,例如活动,片段或应用程序窗口小部件的UI。

如何计算设备像素比

我想知道-webkit-device-pixel-ratio是如何计算的。我已经读过这个了。但我却无法清楚地理解它。 我也想知道是否有哪个设备的列表...

回答 6 投票 0

如何在android中禁用状态栏而不隐藏它?

我想永久禁用状态栏,而不是隐藏它。 我可以通过在 system.prop 中指定 qemu.hw.mainkeys=1 并构建图像来禁用导航栏。 但是,我没有找到任何方法来拒绝...

回答 1 投票 0

button.setOnClickListener() 在设备旋转时导致 Android 应用程序崩溃

我正在开发一个项目,该项目在按下按钮时用文本更新文本视图。例如,您按 0,文本视图上就会显示 0。当设备改变方向时,例如当您...

回答 1 投票 0

Android方屏如何使用竖屏布局?

我需要适配一个方形屏幕(1200px * 1200px,160dpi),使用context.resources.configuration.orientation发现它是横向的。如何强制纵向布局? 我已经尝试过了...

回答 1 投票 0

约束布局内的滚动视图不会滚动到父约束的底部

我有一个大约有 12/13 个字段的表单。我在约束布局中使用了滚动视图。下面是 XML 布局的层次结构。问题是,它不会滚动到底部而是滚动......

回答 17 投票 0

我无法在 Android 上使图像透明?

我尝试了一切,但没有成功。请帮助我

回答 3 投票 0

将图像与行中的文本基线对齐

如何将图像与行中文本的基线对齐。 Modifier.alignByBaseline() 适用于文本,但图像不参与对齐。 @可组合 有趣的样本(){ 排( ...

回答 2 投票 0

如何在Android中更改LottieAnimationView的背景颜色

我在我的andriod XML 中使用了LottieAnimationView 和lottie 动画文件。动画文件本身具有透明背景,但 LottieAnimationView 有白色背景,我可以'...

回答 1 投票 0

如何在自定义TextInputLayout中的浮动提示和输入文本之间添加不同的填充?

我正在我的 Android 项目中开发自定义 TextInputLayout。我需要区分浮动提示(标签)和输入文本之间的填充。当提示浮动时(充当标签...

回答 1 投票 0

布局没有出现在我的应用程序的activity_main中

我的应用程序有问题。 今天我已经将我的 android studio 升级到了最新版本。 我已经在手机上运行了我的应用程序,但在 Activity_main.xml 中包含布局(包含新的 ActionBar)...

回答 1 投票 0

android - 相对布局 - 将对象放在彼此之上

是否可以将一个物体放在另一个物体之上? 我在该背景上有一个背景图像(ImageView),我想放一张脸(ImageView)和另一个图像,它是一个语音气泡......

回答 3 投票 0

工具栏布局与父宽度不匹配

我已经阅读了几个类似的主题,但仍然没有找到这个问题的答案。我有一个自定义的工具栏布局: 我已经阅读了几个类似的主题,但仍然没有找到这个问题的答案。我有一个自定义的工具栏布局: <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="#99000000"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar_transparent" android:layout_height="wrap_content" android:layout_width="match_parent" android:fitsSystemWindows="true" android:minHeight="?attr/actionBarSize" app:theme="@style/MyToolbar"> </android.support.v7.widget.Toolbar> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@android:color/white" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_centerInParent="true" android:id="@+id/toolbar_title" /> </RelativeLayout> 这是我的活动代码: toolbar = (Toolbar) findViewById(R.id.toolbar_transparent); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(false); 我的工具栏仍然有左右填充,并且不填充父宽度。我尝试过各种解决方案。我的代码有什么问题吗? 问题是我需要我的工具栏是半透明的。这就是为什么我在布局 android:background="#99000000" 中使用这一行。我将它应用到整个布局,我的工具栏变得半透明,但它没有填充父级的宽度。但是,如果我将 android:background="#99000000" 这条线不应用到整个布局,而是应用到布局中的工具栏小部件,它会正确填充父级,但会失去透明度。这有帮助吗? 如果填充有问题,您可以尝试设置 contentInset 属性: https://developer.android.com/reference/android/widget/Toolbar.html#attr_android:contentInsetStart 尝试这个布局: 半透明 toolbar <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/general_appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@null"> <android.support.v7.widget.Toolbar android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="#99000000"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:text="Login" android:textSize="20sp" /> </android.support.v7.widget.Toolbar> </android.support.design.widget.AppBarLayout> 输出: 要修改工具栏元素,请添加以下属性: app:contentInsetLeft="0dp" app:contentInsetStart="0dp" 示例: <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:contentInsetLeft="0dp" app:contentInsetStart="0dp"> <!--Your Custom Child View--> </androidx.appcompat.widget.Toolbar> contentInsetStart的默认值通常为16dp,但您需要根据您的要求将其明确设置为0dp。

回答 3 投票 0

Flutter singlechildscrollview布局错误

我编写了如下所示的简单屏幕。 然而 singlechildscollview 列隐藏了上面的 +/- 按钮。 为什么会出现这种症状呢?我该如何解决它? 我的开发情况如下 安卓:2024.1.1

回答 1 投票 0

SearchView 光标不可见

我的搜索视图中的光标不可见。我怎样才能让它可见? 我的搜索视图内的光标不可见。我怎样才能让它可见? <androidx.appcompat.widget.SearchView android:id="@+id/edit_query" android:layout_width="0dp" android:layout_height="50dp" android:background="@android:color/white" android:ems="10" android:importantForAutofill="no" android:inputType="text" android:textColor="@color/app_dark_color" android:textStyle="bold" app:iconifiedByDefault="false" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:queryHint="@string/search" app:searchIcon="@drawable/ic_ricerca" tools:ignore="LabelFor" tools:text="Name" /> 我回顾了您的问题以及我们过去遇到的相同问题。我们尝试过的解决方案之一解决了我们的问题。请尝试使用该解决方案,它可能会解决您的问题。 <androidx.appcompat.widget.SearchView android:id="@+id/edit_query" android:layout_width="0dp" android:layout_height="50dp" android:background="@android:color/white" android:ems="10" android:importantForAutofill="no" android:inputType="text" android:textColor="#ff0000" android:textStyle="bold" app:iconifiedByDefault="false" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:queryHint="Search" tools:ignore="LabelFor" android:theme="@style/searchViewTheme" tools:text="Name" /> 样式.xml <style name="searchViewTheme"parent="Theme.MaterialComponents.DayNight.DarkActionBar"> <item name="colorControlActivated">@android:color/holo_orange_dark</item> </style> 解决方案: 以下是在使用 Kotlin 在 Android 应用程序中扩展布局后如何请求 EditText 的焦点: 科特林 绑定?.searchField?.post {holder.editTextInput.requestFocus()}

回答 2 投票 0

如何在Android中制作浮动的NavigationView

我想复制Google在其应用程序中的菜单,但我不知道是否有像NavigationView和DrawerLayout这样的组件允许制作此菜单,但这不是固定的...

回答 1 投票 0

没有android studio进行android开发的替代方法是什么?

我想成为一名 Android 开发人员。由于 Android Studio 非常需要内存,因此我的计算机上没有足够的内存用于 Android Studio。但我想在没有 Android S 的情况下继续 Android 开发...

回答 1 投票 0

更改无边框按钮的内边距

我正在开发一个应用程序,但遇到了一个小问题。我是无边框按钮样式 (style="@style/Base.Widget.AppCompat.Button.Borderless.Colored") 的超级粉丝,但我无法改变...

回答 2 投票 0

展开后自动滚动CardView

我正在开发一个 Android 应用程序,它有一个 ListView,其中包含使用自定义 ArrayAdapter 填充的 CardView。 CardView 有一个可扩展区域,通过滑动单击即可可见...

回答 2 投票 0

如何让数据绑定与 RRO 或 SRRO 一起使用

所以android让你使用数据绑定将可观察数据直接绑定到XML,这是有效的,我非常熟悉。 现在的问题是这如何与运行时资源覆盖一起使用? RRO 等...

回答 1 投票 0

RecyclerView - 连续列布局

我正在尝试创建一种布局,其中项目将在列中相互跟随(见下图),但我还没有到达那里。我尝试过 GridLayoutManager 和 StaggeredGridLayoutManager -

回答 4 投票 0

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