Android 如何在线性布局的顶部绘制边框
我遵循了中的渐变分割器示例: 我试图在线性布局的底部画一条水平线 这是我的线性布局文件:Android 如何在线性布局的顶部绘制边框,android,Android,我遵循了中的渐变分割器示例: 我试图在线性布局的底部画一条水平线 这是我的线性布局文件: 我认为在父线性布局视图中可能缺少方向 <LinearLayout android:orientation="vertical" 对于您发布的代码,这是非常好的。但是大小为1dp的事实可能不会显示它。增加大小或只需要一条线,请使用此可从android绘制的默认线 android:background="@android:drawable/divider_horizontal_bright" //
我认为在父线性布局视图中可能缺少方向
<LinearLayout android:orientation="vertical"
对于您发布的代码,这是非常好的。但是大小为1dp
的事实可能不会显示它。增加大小或只需要一条线,请使用此可从android绘制的默认线
android:background="@android:drawable/divider_horizontal_bright"
// this for white background only
我希望这将帮助您获得您想要的如果高度为1dp,它将不可见。请尝试2dp:
只有当尺寸至少为2dp时,才会显示黑色边框。尝试删除边框,并将纯色设置为黑色:
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#000" />
</shape>
然后可以再次使用1dp的高度
<View android:layout_alignParentBottom="true"
android:background="@android:drawable/divider_horizontal_bright"
// this for white background only
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#000" />
</shape>