分隔符填充,忽略它
我对这个分隔符有一个问题:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<padding android:left="10dip" android:right="10dip"/>
<solid android:color="@color/listSeparator"/>
<size android:height="1px" />
</shape>
我试图在列表视图组件的左侧/右侧做一些边距/填充(使用相对的,而不是 ListView 对象)。然后,当我尝试这样表达时……
getListView().setDivider(getResources().getDrawable(R.drawable.song_separator));
它会被直接忽略,并放置一个完整的布局分隔符。
现在我不知道问题是什么,但我知道:
- 我不能在所有 ListView 中添加边距,因为我想要 listHeader fill_parent
- 我试图添加一个假边框,但它看起来不太好我改变它的背景颜色,给我一个分隔符空间。
有什么想法吗?
修改
我最后的部分解决方案是放置一个 ImageView ,与父底部对齐。 这是部分原因,因为它放在底部而不是原来的分隔板上。
如果有人能告诉我如何将 ImageView 放在分隔线的精确线上,我也会给他 +50。
I have a problem with this separator:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<padding android:left="10dip" android:right="10dip"/>
<solid android:color="@color/listSeparator"/>
<size android:height="1px" />
</shape>
I'm trying to make a little margin/padding in the left/right of the listview component (using a relative on it , not a ListView Object) . Then when i try to put it this way...
getListView().setDivider(getResources().getDrawable(R.drawable.song_separator));
... it's directly ignored , putting a full layout separator .
Now i don't know what is the problem , but i know that :
- I can't put a margin in all ListView , cause i want the listHeader fill_parent
- I have tried to put a false border , but it isn't nice looking when i change it's background color , putting me a separator space.
Any idea?
MODIFIED
My last partial solution is to put an ImageView , aligned next to the parent bottom .
This is partial cause it puts on the bottom but not on the original divider.
If someone can tell me how to put that ImageView on the exact line of the divider, i would give him the +50 too.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Quiroga 所以我的第一个赌注是通过将方法调用分成单独的行来使代码更易于调试。
我知道它看起来有点过于复杂,但这样您就可以确保找到 Drawable 并且是正确的,然后正确分配给 ListView。
您可以尝试的另一件事是分配一个不同的平台特定分隔符,看看它是否正常工作。
另请尝试获取Android 源代码已重新上线 如果将其添加到 Java 项目中,您可以调试平台类并深入调试平台代码。
所以这并不是真正解决您的问题,但也许它可以帮助您找到解决方案。
Quiroga so my first bet would be to make the code more debugable by spliting the method call up into individual lines.
I know it looks kind of over complicated but that way you can make sure that the Drawable is found and is the correct one and then properly assigned to the ListView.
Another thing you can try is just assigning a different maybe platform specific separator and see if that works properly.
Also try to get your hands on the Android Source Code it is back online if you add that to your Java Project you can debug into the Platform classes and debug deep into the platform code.
So this isn't really a solution for your problem but maybe it can help you find the solution.
将标头放在单独的文件中并按如下方式访问:
public class AuditActivity extends ListActivity {
// switchTabSpecial();
点击
这个链接......它有详细的信息,使用RelativeLayout而不是Linear One,我希望这会对你有所帮助。
Android:将静态标头添加到 ListActivity 的顶部< /a>
Put the header in a separate file and access it as:
public class AuditActivity extends ListActivity {
// switchTabSpecial();
}
Follow this link .......it has a detailed info,use RelativeLayout instead of Linear One, I hope this will help you.
Android: Adding static header to the top of a ListActivity