简体   繁体   English

为什么我的可绘制 ListView 分隔线被拉伸?

[英]Why is my drawable ListView divider stretched?

i use a drawable as my divider in the listview.我在列表视图中使用可绘制对象作为我的分隔符。 my drawable is a down arrow.我的drawable是一个向下箭头。 but when it is displayed on the screen its width stretched.但是当它显示在屏幕上时,它的宽度会被拉伸。 i know there is a way to set divider height with, but is there a way to set its width?我知道有一种方法可以设置分隔线的高度,但是有没有办法设置它的宽度?

<ListView android:id="@android:id/list" 
  android:layout_width="match_parent"
  android:layout_height="match_parent" 
  android:divider="@drawable/down_arrow" 
  android:dividerHeight="1dp"
  android:cacheColorHint="@android:color/transparent"
  android:layout_gravity="center"
  android:layout_below="@id/title">
</ListView>

Use a nine patch image as your divider (stretch transparent pixels on both sides).使用九个补丁图像作为分隔线(在两侧拉伸透明像素)。 You cannot set the width of the list divider.您不能设置列表分隔线的宽度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM