- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我试图构建一个抽屉导航,为此我从某个网站复制了代码,但我在其中一个 XML 中遇到了这个错误。
No resource found that matches the given name (at 'paddingBottom' with value '@dimen/ activity_vertical_margin')
如何摆脱这个错误?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".TabbedActivity$DummySectionFragment" >
<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
最佳答案
单击新创建的“dimens.xml”文件。删除其中的所有代码并粘贴以下内容:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="activity_vertical_margin">8dp</dimen>
<dimen name="activity_horizontal_margin">8dp</dimen>
</resources>
应该可以的
关于android - 找不到与给定名称匹配的资源(在 'paddingBottom' 处,值为 '@dimen/activity_vertical_margin' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28005048/
是否可以在另一个维度中使用维度资源的引用?我的意思是这样的: 文件dimen.xml: 18sp @dimen/test1 最佳答案 它按照我发布的方式工作 18sp @dimen/test1 关于a
我无法理解 dimen 资源属性。 我有 3 个值文件夹:value-normal、value-large 和 value-xlarge。 我已经将标题大小定义为正常 20,大 25,超大 30,这是
我有 2 台测试设备,即 Oneplus 3T 和三星 S9。我在 xxhdpi 文件夹(适用于 Oneplus 3T)和 xxxhdpi 文件夹(适用于三星 S9)中创建了 dimens.xml。坦
在我的应用程序检查屏幕功能后,我需要在运行时选择特定的 dimens.xml。我不想通过项目文件夹(\values,\values-large,...)自动选择来为我选择 Android。 由于我的低
我必须为两种不同类型的设备提供两种不同的字体大小。第一组是较小的设备(例如 Nexus S,或高度约为 480 像素的设备),第二组是所有其他手机(例如 Galaxy Nexus、Nexus 4、5
我不熟悉使用多个屏幕,需要以下方面的帮助: 我有 2 台设备: 三星 S4 展示类:普通 最小宽度:360dp 分辨率:1080 * 1920 密度等级:XXHDPI 密度:442dpi 三星平板电脑
找不到资源。这是我的资源: 维度.xml 10dp 在我的 fragment 中,我尝试了以下各项: val padding = getResources().getDimension(R
在我的 dimens.xml 中我有: 7sp 在我的代码中: Logger.i(getClass(), "size is " + getResources().getDimension(R.dime
我只想根据分辨率缩放文本,所以我创建了: /res/values-ldpi/dimens.xml /res/values-mdpi/dimens.xml /res/values-hdpi/dimens
我使用 dimen.xml 来支持多种屏幕尺寸。 我如何访问文件并从代码中获取维度以便在应用程序中使用? 约夫 最佳答案 您可以使用以下内容: float yourDimen = getResourc
嘿嘿 friend 们, 目前我正在学习 Android Studio 的新布局编辑器和新的ConstraintLayout。 顺便说一句,我讨厌它。 但我遇到了问题,如果我想用 @dimen 指定
在下面的代码中: @dimen/activity_vertical_margin 是做什么的?我找不到它的任何文档。我知道填充是什么。我只想了解 @dimen/activity_vertical_m
创建尺寸资源文件时可用限定符中的最小屏幕宽度和屏幕宽度之间有什么区别。它们如何影响设备?请澄清我的疑问 最佳答案 假设您有一个 720X480 的屏幕,那么最小宽度始终为 480,但如果屏幕是纵向屏幕
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
我的 res/dimens.xml 中有一个维度资源设置,如下所示: 40.0dp 但是,当我像这样将它抓取到一个 float 对象中时: float cornerRadius = R.dimen.c
我正在尝试让我的 Android 应用程序支持多种屏幕尺寸。我试图通过使用不同的 dimens.xml 文件更改布局的 dp 值来将我的替代布局保持在最低限度。 糟糕的部分是我有 9 个不同的文件夹,
我想使用类似于 androids dimens.xml 的东西来在我的应用程序中强制执行一致性。 考虑到它在 Flutter 中的高度集成度,我确信 Material Design 会有一些预定义的值
如果我有一个 2 行 2 列的表格布局。每个象限表框都有静态文本,如“box_11”、“box_12”、“box_21”、“box_22”。我希望文本大小在大屏幕上更大,在小屏幕上更小。我希望文本根据
我的项目目前只有一个 dimens 文件。我知道我所有的 dimens 在 nexus 5 上看起来都不错,我相信它的 dpi 为 445,dpx 为 3。我的问题是这是否使它成为 mdpi、hdpi
我有点困惑如何在 AndroidStudio 中处理多个 dimens.xml 文件(不是针对不同的屏幕分辨率和大小,而是来自多个库模块)。 我有一个 AndroidStudio 项目,它由一个主模块
我是一名优秀的程序员,十分优秀!