0

我正在尝试制作自定义列表视图 AlertDialog。但是 Dialog 的背景颜色是黑色的。

当我滑动列表时,背景颜色变为白色。我不想让我的对话框

背景黑色。什么是问题?

btn_right.setOnClickListener(new Button.OnClickListener(){
        @Override
        public void onClick(View v){
            Dialog dialog2 = new Dialog(context); 
            ListView modeList = new ListView(context); 
            AlertDialog.Builder builder = new AlertDialog.Builder(context); 
            SectionedAdapter adapter;  //custom adapter
            adapter = new SectionedAdapter(context);
                builder.setTitle("list"); 
                builder.setView(modeList);          
                adapter.addSection("7th", new ArrayAdapter<String>(context,
                        R.layout.member_list, R.id.member_text, stringList));
                modeList.setAdapter(adapter); 

                dialog2 = builder.create();
                dialog2.show(); 
4

2 回答 2

3

添加以下代码:

android:cacheColorHint="#00000000"在列表视图中

或者

listview.setCacheColorHint(0);
于 2012-07-11T13:09:34.410 回答
0

使用此代码:

modeList.setCacheColorHint(0);
于 2012-07-11T13:07:38.133 回答