android - 线性布局 (Android) 上的边框问题

标签 android android-layout android-linearlayout

enter image description here

Above is the screen shot of my apps Dashboard screen. Each of the Dash board item is a Linear Layout which i have made clickable and have applied the background.xml on OnClick event to show a different background color on click. The problem i am having is the extra grey line at the top of Purcahse History.

而且我坚持了很久。

这是我的background.xml文件

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
 <solid android:color="@drawable/bgColorButtonClick" />
 <stroke android:width="1dp" android:color="@drawable/llBorderColor" />
 <padding android:left="15dp" android:top="15dp" android:right="15dp" android:bottom="15dp" />
 </shape>

非常感谢任何帮助。 提前致谢。

最佳答案

我认为问题在于您的 background.xml 文件中的笔划。

为什么不以编程方式设置不同的背景颜色呢?例如

layout.setBackgroundColor(Color.DKGRAY);

关于android - 线性布局 (Android) 上的边框问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15558241/

相关文章:

android - LinearLayout 无法在某些设备上添加 View

java - 使用 tomcat 7 从项目中删除 SSL 证书

android - SkImageDecoder 工厂在从资源加载图像时返回 null

Android:如何获取搜索建议

android - 滚动查看并刷新内容

java - 为什么某些 xhdpi 手机不显示位于/res/drawable 中的图像?

Android,后退按钮释放 Activity 内存?

android - 如果软键盘可见,ScrollView 不会滚动

android - 从url下载图片并在android的LinearLayout背景中设置?

android - 创建 ImageView 和 TextView 的 ViewGroup 并以编程方式将其显示在 FlowLayout 中 - Android