我正在使用 com.android.support:cardview-v7:23.3.0。
在 API <> 上,我的 CardView 坚持在底部放置一条黑线,如此处所示
这是我的布局。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<android.support.v7.widget.CardView
android:id="@+id/category_cardView"
android:layout_width="320dp"
android:layout_height="wrap_content"
android:layout_margin="0dp"
card_view:cardBackgroundColor="#80d0d0d0"
card_view:cardCornerRadius="30dp"
card_view:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/list_item_category_imageImageView"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="3dp"
tools:ignore="contentDescription"
tools:src="@drawable/ic_launcher_find_the_fun" />
<ImageButton
android:id="@+id/list_item_category_listButton"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_margin="3dp"
android:background="@drawable/button_selector_category"
android:contentDescription="@string/cd_list"
android:padding="10dp"
android:scaleType="fitXY"
android:src="@drawable/ic_list_black_24dp" />
<ImageButton
android:id="@+id/list_item_category_mapButton"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/list_item_category_listButton"
android:background="@drawable/button_selector_category"
android:contentDescription="@string/cd_map"
android:padding="10dp"
android:scaleType="fitXY"
android:src="@drawable/ic_map_black_24dp" />
<!-- Title -->
<TextView
android:id="@+id/list_item_category_titleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/list_item_category_mapButton"
android:layout_toRightOf="@id/list_item_category_imageImageView"
android:paddingRight="3dp"
android:textSize="17sp"
android:textStyle="bold"
android:typeface="sans"
tools:text="Category Title" />
</RelativeLayout>
</android.support.v7.widget.CardView>
我尝试了各种方法来删除它。如果我删除包含“card_view:cardCornerRadius="30dp""的行,这就是我所看到的:
如果我明确设置 card_view:cardCornerRadius="0dp",我会看到与上面完全相同的结果。
我的布局中的以下变体没有解决这个问题(我尝试这些主要是为了调试,而不是因为我真的希望它们有所作为)。
你能建议这个布局有什么问题,甚至可以尝试调试步骤吗?
最佳答案
您忘记将 below 属性 添加到您的 CardView 并且它可以工作
XML
card_view:cardElevation="0dp"
或
Java
cardView.setCardElevation(0);
cardView.setElevation()方法和 CardView 属性 android:elevation会抛出 java.lang.NoSuchMethodError Android 5.0之前的平台
检查
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<android.support.v7.widget.CardView
android:id="@+id/category_cardView"
android:layout_width="320dp"
android:layout_height="wrap_content"
android:layout_margin="0dp"
card_view:cardBackgroundColor="#80d0d0d0"
card_view:cardCornerRadius="30dp"
card_view:cardElevation="0dp" //added
card_view:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/list_item_category_imageImageView"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="3dp"
tools:ignore="contentDescription"
tools:src="@drawable/ic_launcher_find_the_fun" />
<ImageButton
android:id="@+id/list_item_category_listButton"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_margin="3dp"
android:background="@drawable/button_selector_category"
android:contentDescription="@string/cd_list"
android:padding="10dp"
android:scaleType="fitXY"
android:src="@drawable/ic_list_black_24dp" />
<ImageButton
android:id="@+id/list_item_category_mapButton"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/list_item_category_listButton"
android:background="@drawable/button_selector_category"
android:contentDescription="@string/cd_map"
android:padding="10dp"
android:scaleType="fitXY"
android:src="@drawable/ic_map_black_24dp" />
<!-- Title -->
<TextView
android:id="@+id/list_item_category_titleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/list_item_category_mapButton"
android:layout_toRightOf="@id/list_item_category_imageImageView"
android:paddingRight="3dp"
android:textSize="17sp"
android:textStyle="bold"
android:typeface="sans"
tools:text="Category Title" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
关于android - CardView 在底部插入暗线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36931207/
最近因为项目需要,需要将Android手机系统自带的某个系统软件反编译并更改里面某个资源,并重新打包,签名生成新的自定义的apk,下面我来介绍一下我的实现过程。APK修改,分为以下几步:反编译解包,修改,重打包,修改签名等步骤。安卓apk修改准备工作1.系统配置好JavaJDK环境变量2.需要root权限的手机(针对系统自带apk,其他软件免root)3.Auto-Sign签名工具4.apktool工具安卓apk修改开始反编译本文拿Android系统里面的Settings.apk做demo,具体如何将apk获取出来在此就不过多介绍了,直接进入主题:按键win+R输入cmd,打开命令窗口,并将路
我正在尝试创建一个带有项目符号字符的Ruby1.9.3字符串。str="•"+"helloworld"但是,当我输入它时,我收到有关非ASCII字符的语法错误。我该怎么做? 最佳答案 你可以把Unicode字符放在那里。str="\u2022"+"helloworld" 关于ruby-如何在Ruby字符串中插入项目符号字符?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/1195
我想知道是否可以通过自动创建数组来插入数组,如果数组不存在的话,就像在PHP中一样:$toto[]='titi';如果尚未定义$toto,它将创建数组并将“titi”压入。如果已经存在,它只会推送。在Ruby中我必须这样做:toto||=[]toto.push('titi')可以一行完成吗?因为如果我有一个循环,它会测试“||=”,除了第一次:Person.all.eachdo|person|toto||=[]#with1billionofperson,thislineisuseless999999999times...toto.push(person.name)你有更好的解决方案吗?
在我的用户模型中,我有一堆属性,例如is_foos_admin和is_bars_admin,它们决定允许用户编辑哪些类型的记录。我想干掉我的编辑链接,目前看起来像这样:'edit'ifcurrent_user.is_foos_admin?%>...'edit'ifcurrent_user.is_bars_admin?%>我想做一个帮助程序,让我传入一个foo或bar并返回一个链接来编辑它,就像这样:助手可能看起来像这样(这不起作用):defedit_link_for(thing)ifcurrent_user.is_things_admin?link_to'Edit',edit_poly
我有以下现有的Dog对象数组,它们按age属性排序:classDogattr_accessor:agedefinitialize(age)@age=ageendenddogs=[Dog.new(1),Dog.new(4),Dog.new(10)]我现在想插入一条新的狗记录,并将它放在数组中的正确位置。假设我想插入这个对象:another_dog=Dog.new(8)我想把它插入到数组中,让它成为数组中的第三项。这是一个人为的示例,旨在演示我特别想如何将一个项目插入到现有的有序数组中。我意识到我可以创建一个全新的数组并重新对所有对象进行排序,但这不是我的目标。谢谢!
在字符串连接中,是否可以直接在语句中包含条件?在下面的示例中,我希望仅当dear列表不为空时才连接"mydear"。dear=""string="hello"+"mydear"unlessdear.empty?+",goodmorning!"但是结果报错:undefinedmethod'+'fortrue我知道另一种方法是在这条语句之前定义一个额外的变量,但我想避免这种情况。 最佳答案 使用插值而不是连接更容易和更具可读性:dear=""string="hello#{'mydear'unlessdear.empty?},goodmo
我有一个Ruby数组[1,4]。我想在中间插入另一个数组[2,3],这样它就变成了[1,2,3,4]。我可以使用[1,4].insert(1,[2,3]).flatten实现这一点,但是有更好的方法吗? 最佳答案 您可以通过以下方式进行。[1,4].insert(1,*[2,3])insert()方法处理多个参数。因此,您可以使用splat运算符*将数组转换为参数。 关于ruby-如何在数组中间插入一个数组?,我们在StackOverflow上找到一个类似的问题:
这是字符串:04046955104021109我需要这样格式化:040469551-0402-1109用ruby做到这一点的最短/最有效的方法是什么? 最佳答案 两个简单的插入就可以了:example_string.insert(-9,'-').insert(-5,'-')负数表示您从字符串末尾开始计数。如果您愿意,也可以从头数起:example_string.insert(9,'-').insert(14,'-') 关于ruby-用ruby将2个破折号插入这个字符串的最短方法是
我有一个偏爱:如何将像o.office这样的值插入到属性中?value="#{o.office}"无效。 最佳答案 'type='text'/>或者你可以使用表单助手 关于ruby-on-rails-如何将变量值插入ERB模板中的HTML标签?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/6172174/
我将RoR与PostGIS结合使用来存储位置数据。我正在尝试使用圆(例如,带半径的中心点)来存储估计位置。我试过类似的东西,但它不起作用:@location=Location.new(:place_id=>place.id,:circle=>%{ST_Buffer(ST_MakePoint(#{latitude},#{longitude})::geography,#{accuracy})})我也尝试过使用RGeo,它是出厂设置,但不确定如何准确使用它。任何帮助将不胜感激。谢谢。编辑1:我取得了一些进步。factory=RGeo::Cartesian.factorycenter_poin