当前位置:编程学习 > wap >>

布局奇怪的效果?!各位能帮忙看看吗?

布局奇怪的效果?!

效果
这是奇怪的图片   
下面是代码
RelativeLayout mvLine = new RelativeLayout(this.getBaseContext());
                                mvLine.setClickable(true);
                                mvLine.setOnClickListener(detailListener);
                                mvLine.setBackgroundDrawable(this.getBaseContext()
                                                .getResources().getDrawable(R.drawable.list_bg));
                                //mvLine.setOrientation(android.widget.LinearLayout.HORIZONTAL);

                                ImageView img = new ImageView(this.getBaseContext());
                                img.setImageDrawable(this.getBaseContext().getResources()
                                                .getDrawable(R.drawable.loading_img));
                                img.setPadding(21, 3, 0, 4);

                                ImageLoader.getInstance().loadImage(
                                                hotmvs.item(i).getAttributes().getNamedItem("subimg")
                                                                .getNodeValue(), img, R.drawable.load_err_img);

                                mvLine.addView(img, ViewGroup.MarginLayoutParams.WRAP_CONTENT,
                                                ViewGroup.MarginLayoutParams.WRAP_CONTENT);

                                LinearLayout ll = new LinearLayout(this.getBaseContext());
                                ll.setOrientation(ll.VERTICAL);

                                // name
                                TextView text = new TextView(this.getBaseContext());
                                text.setText("名称:"
                                                + hotmvs.item(i).getAttributes()
                                                                .getNamedItem("subname").getNodeValue());
                                // 前两位是透明度
                                text.setTextColor(0xff000000);
                                text.setTextSize(16);
                                LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
                                                LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

                                lp.topMargin = 17;
                                lp.leftMargin = 12;
                                ll.addView(text, lp);

                                TextView text2 = new TextView(this.getBaseContext());
                                text2.setText("看点:"
                                                + hotmvs.item(i).getAttributes()
                                                                .getNamedItem("subname").getNodeValue());

                                LinearLayout.LayoutParams lp2 = new LinearLayout.LayoutParams(
                                                LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
                                lp2.topMargin = 2;
                                lp2.leftMargin = 12;
                                ll.addView(text2, lp2);
                                
                                
                
                                mvLine.addView(ll, ViewGroup.MarginLayoutParams.FILL_PARENT,
                                                ViewGroup.MarginLayoutParams.FILL_PARENT);

                                EditText et = new EditText(this.getBaseContext());
                                et.setText(hotmvs.item(i).getAttributes().getNamedItem(
                                                "contenturl").getNodeValue());
                                et.setVisibility(EditText.GONE);
                                mvLine.addView(et, ViewGroup.MarginLayoutParams.WRAP_CONTENT,
                                                ViewGroup.MarginLayoutParams.WRAP_CONTENT);

                                ImageButton ib = new ImageButton(this.getBaseContext());
                                ib.setBackgroundDrawable(this.getResources().getDrawable(
                                                R.drawable.arrow)); --------------------编程问答-------------------- 1.增加一个id
private static final int ID_IMG = 1;
2.设置image的id
img.setId(ID_IMG);
3.设置线性布局的layout
RelativeLayout.LayoutParams lp3 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);  
lp3.addRule(RelativeLayout.ALIGN_TOP, ID_IMG);  
lp3.addRule(RelativeLayout.RIGHT_OF , ID_IMG);  
mvLine.addView(ll, lp3); --------------------编程问答-------------------- 居然发了三个!!! --------------------编程问答--------------------
引用 2 楼 hyfeng_ccle 的回复:
居然发了三个!!!

不,他发了四个,一个已经结贴了。 --------------------编程问答-------------------- --------------------编程问答-------------------- --------------------编程问答-------------------- 不是啊 是系统错误啊 我只发了一个啊 呵呵 --------------------编程问答--------------------
引用 6 楼 izhangxueyonghotmail 的回复:
不是啊 是系统错误啊 我只发了一个啊 呵呵

是系统反应慢,点击了发布帖子后没反应以为没发布,你又连续点了3次,导致最后有四个帖子。
回复帖子的时候有时也反应慢,会出现重复回复
既然问题解决了就把重复的都结贴吧
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,