定义安口忽略layout_margin我创建了一个自定义样式:风格
<style name="Static">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginEnd">5dp</item>
</style>
然后我伸出ANKO一个静态函数:
inline fun ViewManager.static(theme: Int = R.style.Static, init: TextView.() -> Unit) = ankoView(::TextView, theme, init)
当我在我的布局中使用这样的:
static { text = resources.getString(R.string.name) }
marginEnd值被忽略。
如果我在安口手动添加保证金:
static { text = resources.getString(R.string.name) }.lparams { marginEnd = dip(5) }
保证金是好的。
你们知道anko忽略我的保证金价值或其他任何方式为扩展视图anko函数定义预定义边距的情况吗?
谢谢主席先生!你现在是我的个人英雄! :) – Antek