ddd
// for (int i = 0; i < 100; i++) {//名词 // //relative // RelativeLayout rLayout=new RelativeLayout(this); // // RelativeLayout.LayoutParams tlp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT); // tlp.addRule(RelativeLayout.ALIGN_PARENT_LEFT); // tlp.addRule(RelativeLayout.CENTER_VERTICAL,RelativeLayout.TRUE); // //添加TextView // TextView tv=new TextView(this); // tv.setId(i+1); // tv.setText("n:"); // tv.setTextSize(24); // tv.setWidth(40); // tv.setHeight(40); // tv.setTextColor(0xff000000); // tv.setLayoutParams(tlp); // rLayout.addView(tv,tlp); // //添加LinearLayout // RelativeLayout.LayoutParams llp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT); // llp.addRule(RelativeLayout.CENTER_VERTICAL); // llp.addRule(RelativeLayout.RIGHT_OF,i+1); // // LinearLayout layout1=new LinearLayout(this); // layout1.setOrientation(LinearLayout.HORIZONTAL); // // Button btn1=new Button(this); // btn1.setWidth(40); // btn1.setHeight(40); // //btn1.setLayoutParams(lp); // btn1.setText("aiiii"); // btn1.setBackgroundResource(R.drawable.case1); // layout1.addView(btn1); // // Button btn2=new Button(this); // btn2.setWidth(40); // btn2.setHeight(40); // //btn1.setLayoutParams(lp); // btn2.setText("aiiii"); // btn2.setBackgroundResource(R.drawable.case1); // layout1.addView(btn2); // // Button btn3=new Button(this); // btn3.setWidth(40); // btn3.setHeight(40); // //btn1.setLayoutParams(lp); // btn3.setText("aiiii"); // btn3.setBackgroundResource(R.drawable.case1); // layout1.addView(btn3); // // rLayout.addView(layout1, llp); // // // //ImageView // ImageView imgV=new ImageView(this); // imgV.setBackgroundColor(0xff995533); // imgV.setMinimumHeight(40); // imgV.setMinimumWidth(40); // RelativeLayout.LayoutParams imglp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT); // imglp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); // imglp.addRule(RelativeLayout.CENTER_VERTICAL,RelativeLayout.TRUE); // imglp.setMargins(0,10,0); // rLayout.addView(imgV, imglp); // // // linearContainer.addView(rLayout); // } // // // TextView tt=new TextView(this); // tt.setBackgroundColor(0x00000000); // tt.setHeight(40); // linearContainer.addView(tt,Lp_fw); // // // for (int i = 0; i < 100; i++) {//动词 // //relative // RelativeLayout rLayout=new RelativeLayout(this); // // RelativeLayout.LayoutParams tlp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, imglp); // // // linearContainer.addView(rLayout); // } // // TextView tt2=new TextView(this); // tt2.setBackgroundColor(0x00000000); // tt2.setHeight(40); // linearContainer.addView(tt2,Lp_fw); // // for (int i = 0; i < 100; i++) {//副词 // //relative // RelativeLayout rLayout=new RelativeLayout(this); // // RelativeLayout.LayoutParams tlp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, imglp); // // // linearContainer.addView(rLayout); // } // // TextView tt3=new TextView(this); // tt3.setBackgroundColor(0x00000000); // tt3.setHeight(40); // linearContainer.addView(tt3,Lp_fw); // // for (int i = 0; i < 100; i++) {//形容词 // //relative // RelativeLayout rLayout=new RelativeLayout(this); // // RelativeLayout.LayoutParams tlp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, imglp); // // // linearContainer.addView(rLayout); // } // // TextView tt4=new TextView(this); // tt4.setBackgroundColor(0x00000000); // tt4.setHeight(40); // linearContainer.addView(tt4,Lp_fw); // // for (int i = 0; i < 100; i++) {//介词 // //relative // RelativeLayout rLayout=new RelativeLayout(this); // // RelativeLayout.LayoutParams tlp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, imglp); // // //linearContainer.addView(rLayout); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |