ListActivity 使用 BaseAdapter 的扩展和以下布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@color/application_background_color">
<ListView android:id="@android:id/list" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:drawSelectorOnTop="false"
android:divider="@drawable/divider"
android:dividerHeight="2dip" android:clickable="true"
android:choiceMode="singleChoice"
android:cacheColorHint="@color/application_background_color">
</ListView>
</LinearLayout>
它为行膨胀以下布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<TextView android:id="@+id/Row"
android:layout_width="fill_parent" android:layout_height="50dip"
android:textSize="20dip" android:textColor="#000000"
android:layout_margin="8dip"
android:gravity="center_vertical"></TextView>
</LinearLayout>
drawable/divider.xml 目前看起来像这样,但我尝试了所有不同的类型:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke android:color="#FF000000">
</stroke>
</shape>
如果我从图像中读取可绘制对象,它就可以工作。为什么当我将可绘制对象定义为 .xml 文件时它不起作用?
更新:
代码遵循与 Android 开发人员示例中的 EfficientAdapter 相同的模式:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html
最佳答案
下面的代码对我有用:
列表布局:
<ListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list"
android:cacheColorHint="@android:color/transparent"
android:background="@android:color/transparent"
android:textFilterEnabled="false"
style="@style/ListDivider"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ListView>
样式.xml
<resources>
<style name="ListDivider">
<item name="android:divider">@drawable/my_shape</item>
<item name="android:dividerHeight">5dp</item>
</style>
</resources>
我的形状:
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<padding
android:top="2dp"
android:left="2dp"
android:right="2dp"
android:bottom="2dp" />
<corners
android:radius="5dp" />
<solid
android:color="@android:color/white" />
</shape>
关于android - ListView 分隔线不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6748127/
最近因为项目需要,需要将Android手机系统自带的某个系统软件反编译并更改里面某个资源,并重新打包,签名生成新的自定义的apk,下面我来介绍一下我的实现过程。APK修改,分为以下几步:反编译解包,修改,重打包,修改签名等步骤。安卓apk修改准备工作1.系统配置好JavaJDK环境变量2.需要root权限的手机(针对系统自带apk,其他软件免root)3.Auto-Sign签名工具4.apktool工具安卓apk修改开始反编译本文拿Android系统里面的Settings.apk做demo,具体如何将apk获取出来在此就不过多介绍了,直接进入主题:按键win+R输入cmd,打开命令窗口,并将路
例如,如果我有YAML文件en:questions:new:'NewQuestion'other:recent:'Recent'old:'Old'这最终会变成一个json对象,例如{'questions.new':'NewQuestion','questions.other.recent':'Recent','questions.other.old':'Old'} 最佳答案 由于问题是关于在Rails应用程序上使用YAML文件进行i18n,因此值得注意i18ngem提供了一个辅助模块I18n::Backend::Flatten完全像
我正在尝试将种子数据从CSV文件加载到我的Rails应用程序中。我最初安装了fastercsvgem,却发现从ruby1.9开始,fastercsv已被弃用,取而代之的是CSV库。所以在收到一个非常有用的错误告诉我切换后,我切换到CSV。然而,现在我遇到了最奇怪的现象,当我加载数据时一切看起来都很正常,但我似乎无法查询字符串字段。字符串字段由看似正确的字符串填充,但我无法访问它们。我可以查询任何数字字段,结果将返回,但不会返回字符串字段。我尝试使用引号的定界符,但无济于事。我什至从我的csv文件中删除了所有引号,但我仍然无法查询字符串字段。下面是我的代码,以及一些来自Rails控制
当我尝试使用“套接字”库中的方法“read_nonblock”时出现以下错误IO::EAGAINWaitReadable:Resourcetemporarilyunavailable-readwouldblock但是当我通过终端上的IRB尝试时它工作正常如何让它读取缓冲区? 最佳答案 IgetthefollowingerrorwhenItrytousethemethod"read_nonblock"fromthe"socket"library当缓冲区中的数据未准备好时,这是预期的行为。由于异常IO::EAGAINWaitReadab
我正在使用TrixWYSIWYGeditor在我的应用程序中。对于我的capybara测试:我要填写编辑器。我找到了这篇文章:Howtotestbasecamp'stripeditor...这似乎很有希望。不幸的是,它一直给我这个错误:Selenium::WebDriver::Error::ElementNotVisibleError:elementnotvisible所以看起来Capybara发现元素没问题,但它只是没有与之交互,因为Capybara必须有一些默认设置才能不与隐藏/不可见元素交互。环顾四周后,我发现了这个Stackoverflow问题:Isitpossibletoin
对于最近的一个项目,我有几个View是这样的代码:这在开发模式下工作得很好......我将它推出到生产模式并且它爆炸了,说count不是Array的有效方法。我将每个实例都改为使用Array#length,它似乎可以正常工作。1)这种行为差异的原因是什么?2)我应该注意开发模式和生产模式之间的任何其他令人兴奋的差异吗?道德:确保您的生产托管环境使用与本地开发环境相同的Ruby版本。:)谢谢汤姆 最佳答案 count方法仅在Ruby1.9及更高版本中可用。我建议您使用与服务器相同版本的Ruby以避免此类问题-1.9中发生了很多变化
根据AWSDocs:Anupdateexpressionconsistsofoneormoreclauses.EachclausebeginswithaSET,REMOVE,ADDorDELETEkeyword.Youcanincludeanyoftheseclausesinanupdateexpression,inanyorder.However,eachactionkeywordcanappearonlyonce.我无法在一个update_expression中获得正确的SET和REMOVE语法:params={key:{'id'=>{s:'123'}},table_name:'c
我有一个Profile模型,它有很多属性,比如电子邮件、图像、年龄、地址等。最终用户可以将某些属性设为私有(private),以便其他用户无法查看。我通过向表private_attr添加一列并将其序列化以存储哈希来解决这个问题:-{email:true,address:true,age:false}这里的属性作为具有值true的键被认为是私有(private)的,不会向除这些属性所属的用户以外的用户显示。我想知道这是解决这个问题的最好方法,还是有其他方法。提前致谢。 最佳答案 我认为您可以只序列化用户希望在数组中私有(private
我想用逗号分割一个字符串:"a,s".split','#=>['a','s']如果子字符串被括号包裹,我不想拆分它:"a,s(d,f),g,h"应该产生:['a','s(d,f)','g','h']有什么建议吗? 最佳答案 要处理嵌套括号,可以使用:txt="a,s(d,f(4,5)),g,h"pattern=Regexp.new('((?:[^,(]+|(\((?>[^()]+|\g)*\)))+)')putstxt.scan(pattern).map&:first图案细节:(#firstcapturinggroup(?:#ope
我见过不同的人为此使用不同类型的牙套/括号。我在脚本控制台中试用了它们,它们都有效。为什么它们都有效?使用哪个有关系吗?%w|onetwo|%w{onetwo}%w[onetwo]%w(onetwo)实际上,可以使用更多种类的字符。可以使用除=之外的任何非字母数字字符。%w!a!%w@b@%w#c#%w$d$%w%e%%w^f^%w&g&%w*h*%w(i)%w_j_%w-k-%w+l+%w\m\%w|n|%w`o`%w~p~%w[q]%w{r}%w;s;%w:t:%w'u'%w"v"%w,w,%w%w.y.%w/z/%w?aa? 最佳答案