I have some problem with setting params to my view in xml file with values from dimen files.
我在使用dimen文件中的值在xml文件中为我的视图设置params时遇到了一些问题。
For example when i'm adding layout_height param to my EditText in laytout xml file:
例如,当我在layouttout xml文件中将layout_height param添加到我的EditText时:
<EditText
....
android:layout_height="@dimen/et_height"
....
/>
File dimens:
文件尺寸:
<resources>
.........
<dimen name="example">16dp</dimen>
<dimen name="et_height">20dp</dimen>
.........
</resources>
It works fine. But sometimes when i open this file again AndroidStudio replace @dimen/et_height with value 20dp in layout xml file. And i must change it again to @dimen/et_height. How can i fix this ?
它工作正常。但有时当我再次打开此文件时,AndroidStudio会在布局xml文件中替换@ dimen / et_height,值为20dp。我必须再次改为@ dimen / et_height。我怎样才能解决这个问题 ?
This is the normal case:
这是正常情况:
But in my case AndroidStudio replaces with value:
但在我的情况下,AndroidStudio取代了价值:
1 个解决方案
#1
0
Having the same issue. Thought it is the ConstraintLayout but the issue also appears in every other layout though..
有同样的问题。认为它是ConstraintLayout但问题也出现在其他所有布局中虽然..
related post from me : Android ConstraintLayout @dimens replaced with hardcoded values
来自我的相关帖子:Android ConstraintLayout @dimens替换为硬编码值
Also some other user said it just shows the dp value, i am completely in your situation i know the grey text, but it does really replace the value..
还有一些其他用户说它只是显示dp值,我完全在你的情况我知道灰色文本,但它确实取代了值..
#1
0
Having the same issue. Thought it is the ConstraintLayout but the issue also appears in every other layout though..
有同样的问题。认为它是ConstraintLayout但问题也出现在其他所有布局中虽然..
related post from me : Android ConstraintLayout @dimens replaced with hardcoded values
来自我的相关帖子:Android ConstraintLayout @dimens替换为硬编码值
Also some other user said it just shows the dp value, i am completely in your situation i know the grey text, but it does really replace the value..
还有一些其他用户说它只是显示dp值,我完全在你的情况我知道灰色文本,但它确实取代了值..