Tag: margin

Android:alignment父级底部+底部边距

我已经使用了一个相对布局,我想在屏幕底部设置button,但是这一切都放在了底部,我想有一些保证金,所以它之间的屏幕/查看和button。 然而,无论我做button的边缘只是没有做任何事情2.1 +由于某种原因。 相对布局包含一个背景,所以我不能,但在边缘。 任何人都知道这个解决办法? <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginBottom="0dp" android:background="@drawable/background" > <Button android:id="@+id/confirm_mobile_button_next" android:layout_width="fill_parent" android:layout_height="40dip" android:layout_alignParentBottom="true" android:layout_alignParentLeft="false" android:layout_centerHorizontal="false" android:layout_centerInParent="false" android:layout_margin="15dp" android:background="@drawable/button_shape_selector" android:paddingLeft="10dip" android:paddingRight="10dip" android:text="@string/confirm_mobile_no_continue" android:textColor="@color/white" android:textStyle="bold" /> </RelativeLayout>

如何添加一个简单的8dp页眉/页脚到Android的RecyclerView?

有没有办法添加一个简单的页眉/页脚到RecyclerView? 在这里你可以看到我有什么。 第一张卡片触摸工具栏 在这里,你可以看到我想要的。 底部和卡之间填充8dp。 我到目前为止尝试的方法: 在我的recyclerview中使用标题视图。 但是我认为这对于每个回收者来说都是非常不够的。 使用8dp的上边距,导致滚动时回收站的顶部/底部出现白条的问题。 在列表项中添加一个填充项,这会在外部和内部卡之间产生不同的边距。 我确信有一个我不知道的简单解决scheme。

如何使用代码设置ImageView的边距,而不是xml

我想添加一个未知数量的ImageView视图到我的布局与保证金。 在XML中,我可以像这样使用layout_margin : <ImageView android:layout_margin="5dip" android:src="@drawable/image" /> 有ImageView.setPadding() ,但没有ImageView.setMargin() 。 我认为这是沿着ImageView.setLayoutParams(LayoutParams) ,但不知道该怎么喂。 有人知道吗?