随时随地技术实战干货,获取项目源码、学习资料,请关注源代码社区公众号(ydmsq666)
fadingEdge属性用来设置拉滚动条时 ,边框渐变的放向。none(边框颜色不变),horizontal(水平方向颜色变淡),vertical(垂直方向颜色变淡)。
fadingEdgeLength用来设置边框渐变的长度。
测试示例:
MainActivity:
package com.home.testedge;import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;public class MainActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);ListView lv = (ListView) findViewById(R.id.main_list);// 在代码里设置边框渐变宽度// lv.setFadingEdgeLength(0);// 去掉分割黑线lv.setDivider(null);String[] data = new String[] { "item1", "item2", "item3", "item4","item5", "item6", "item7", "item8", "item9", "item10","item11", "item12" };ArrayAdapter adapter = new ArrayAdapter(this,android.R.layout.simple_list_item_1, data);lv.setAdapter(adapter);}
}
布局xml: