移除android中ListView顶部和底部的阴影?

移除android中ListView顶部和底部的阴影?,android,listview,Android,Listview,我已经创建了一个自定义listView,该行如下所示: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:id="@+id/lay1" android:layout_height="wrap_content" android:background="#ffffff"> <Te

我已经创建了一个自定义listView,该行如下所示:

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"  android:id="@+id/lay1" 
  android:layout_height="wrap_content" android:background="#ffffff">

  <TextView android:layout_width="fill_parent" android:textColor="#000000" android:id="@+id/text"
  android:layout_height="wrap_content" android:layout_toRightOf="@+id/check" 
  android:textSize="15dip" android:paddingBottom="5dip" android:paddingRight="10dip" android:paddingLeft="10dip"></TextView>

  <Button android:id="@+id/check"  android:layout_centerVertical="true"
          android:background="@drawable/uncheck" android:layout_width="wrap_content"
          android:layout_height="wrap_content" android:visibility="gone"></Button>

  <EditText android:layout_width="fill_parent" android:textColor="#000000" android:id="@+id/edit"
  android:layout_height="wrap_content"  android:background="@null" android:layout_below="@+id/text"
  android:textSize="15dip" android:paddingTop="5dip" android:paddingRight="10dip" android:paddingLeft="10dip"
  android:layout_toRightOf="@+id/check" android:paddingBottom="5dip" ></EditText>

</RelativeLayout>
public class Adapter extends BaseAdapter {


        ArrayList<Row> row;
        private Context context;


        public Adapter(Context context, ArrayList<SongRow> songrow) {

            this.context = context;
            this.row = row;

        }

        public int getCount() {

            return row.size();
        }

        public Object getItem(int position) {
            return position;
        }

        public long getItemId(int position) {
            return position;
        }

        public View getView(int position, View convertView, ViewGroup parent) {

            long sub_id = row.get(position).getSub_id();
            String sub_title = row.get(position).getSub_title();
            String sub_text = row.get(position).getSub_text();

            if (convertView == null) {
                LayoutInflater inflat = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                convertView = inflat.inflate(R.layout.mainrow, null);

            } else {
                LayoutInflater inflat1 = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                convertView = inflat1.inflate(R.layout.mainrow, null);
                            }
            final TextView name = (TextView) convertView.findViewById(R.id.text);
            final EditText et = (EditText) convertView.findViewById(R.id.edit);
            name.setText(sub_title);
            et.setText(sub_text);
            et.setFilters(new InputFilter[] { new InputFilter() {
                public CharSequence filter(CharSequence src, int start,
                        int end, Spanned dst, int dstart, int dend) {
                       InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                       mgr.hideSoftInputFromWindow(et.getWindowToken(),0);
                       et.setCursorVisible(false);
                       return dst.subSequence(dstart, dend);    

                }
            } });
            et.setOnFocusChangeListener(new OnFocusChangeListener() {

                @Override
                public void onFocusChange(View v, boolean hasFocus) {
                    // TODO Auto-generated method stub
                    if (hasFocus) {
                         InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                         mgr.hideSoftInputFromWindow(et.getWindowToken(),0);
                         et.setCursorVisible(false);
                    }
                }

            });
            et.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                     InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                     mgr.hideSoftInputFromWindow(et.getWindowToken(),0);
                     et.setCursorVisible(false);

                }
            });
            return convertView;
        }
    }
Adapter s = new Adapter(MainActivity.this, row);
            mainlist.setAdapter(s);
            mainlist.setSelection(length-1);
我的代码工作得很好。我的问题是,当显示可滚动的listview时,在listview的顶部和底部会出现阴影,我不想显示它。我怎样才能消除那个阴影


提前谢谢

我想你说的是褪色边缘。要禁用它们,请执行以下操作:

android:fadingEdge="none"

更新

正如Pim Reijersen在评论中指出的那样,
android:fadingEdge
已被弃用,从API级别14起将被忽略。请使用:

android:fadingEdgeLength="0dp"

尝试下面的代码片段

listView.setVerticalFadingEdgeEnabled(false);

android:fadingeLength
对我不起作用,我曾经使用过,并且与
android:overScrollMode=“never”

将android:overScrollMode=“never”添加到您的滚动视图中

这对我很有用

android:fadeScrollbars="false"
android:fadingEdge="none"
android:fadingEdgeLength="0dp"
android:cacheColorHint="#00000000"
android:overScrollMode="never"
将其添加到XML中:

android:fadingEdge="none" or android:fadingEdgeLength="0dp"

在XML滚动视图中使用此选项:

android:overScrollMode="never"

您可以设置为“始终”、“从不”或“ifContentScrolls”。

您所说的“不工作”是什么意思?如果你将它应用于任何类型的视图,是的,它正在工作:哇!第二个对我有用,即动态设置listView.setVerticalFadingEdgeEnabled(false);但为什么第一个不…。我不知道有谁能解释Android:fadingEdge被弃用,并且将在API级别14时被忽略。改用android:fadingEdgeLength=“0dp”。android:fadingEdgeLength=“0dp”不适用于我,我使用@Chathura WijesingheRead接受答案的解决方案:。这会有用的。@Yash让我失望了,请检查详细信息我已经尝试了
fadingEdge
requiresFadingEdge
fadingeLength
的各种组合。只有这一个成功了!
android:fadingEdge="none" or android:fadingEdgeLength="0dp"
android:overScrollMode="never"