Tag: android styles

Anko忽略了在样式中定义的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值被忽略。 如果我在anko中手动添加边距: static { text = resources.getString(R.string.name) }.lparams { marginEnd = dip(5) } 保证金很好。 你们知道anko正在忽略我的保证金价值或其他方式为扩展视图anko函数定义一个预定义的保证金吗?

为什么这个anko布局不正确地处理系统ui?

我尝试了Anko,不能得到这个布局来处理像xml版本的系统用户界面。 我认为它与主题有关,以及它们是如何通过xml解析来处理的。 这里是截图: 这里是anko DSL组件: class ActivityMainLayout : AnkoComponent<Activity> { lateinit var drawerLayout: DrawerLayout lateinit var appBarLayout: AppBarLayout lateinit var toolbar: Toolbar lateinit var text: TextView lateinit var navHeader: NavigationView lateinit var toggle: ActionBarDrawerToggle override fun createView(ui: AnkoContext<Activity>): View = with(ui) { drawerLayout = drawerLayout { fitsSystemWindows = true coordinatorLayout { appBarLayout = appBarLayout(theme = […]

自定义菜单上的按钮点击下拉

我正在尝试实现flipkart应用程序的操作栏功能。 。 为此,我成功地创建了一个自定义的操作栏,但是我在将菜单显示为溢出图标点击时遇到问题。 如果我在按钮上尝试安卓选项菜单,然后点击屏幕底部中心的图标(4.2.2)。 使用自定义对话框或警报对话框淡化背景,并且它们也出现在屏幕的中心。 我应该做些什么来获得类似于上图所示的功能?

如何改变Android中EditText的焦点颜色

如何更改EditText框上的焦点颜色(橙色)? 焦点颜色是整个控件周围的一个小圈,当控件具有焦点时,它是亮橙色。 我如何将焦点的颜色改变为不同的颜色? 任何人都可以帮我解决这个问题? 提前致谢,