0
Tablerow에서 4 개의 이미지 뷰가 있습니다. 그것들은 layout_weight 명령을 통해 크기가 조정됩니다. 나는 지금이 Imageviews에 쓸 필요가있다. 상대 레이아웃을 사용하여 정렬 된 의미를 사용하지 않고이 작업을 수행 할 수 있습니까?Imageview에서 이미지 뷰를 사용하여 이미지 뷰를 배치합니다. layout_weight를 사용합니다.
TableRow.LayoutParams params = new TableRow.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1f);
TableRow.LayoutParams params1 = new TableRow.LayoutParams(0,ViewGroup.LayoutParams.WRAP_CONTENT,1.2f);
TableRow.LayoutParams params2 = new TableRow.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 2.4f);
TableRow.LayoutParams params3 = new TableRow.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 3.6f);
TableRow.LayoutParams params4 = new TableRow.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 4.8f);
TableRow tableRow = new TableRow(this);
tableRow.setLayoutParams(params);
ImageView rank = new ImageView(this);
rank.setAdjustViewBounds(true);
rank.setLayoutParams(params1);
rank.setImageResource(R.drawable.whitebutton);
Layout[i] = new ImageView(this);
Layout[i].setLayoutParams(params2);
Layout[i].setImageResource(R.drawable.width2);
Layout[i].setAdjustViewBounds(true);
Layout[i+10] = new ImageView(this);
Layout[i+10].setLayoutParams(params3);
Layout[i+10].setImageResource(R.drawable.width3);
Layout[i+10].setAdjustViewBounds(true);
Layout[i+20] = new ImageView(this);
Layout[i+20].setLayoutParams(params4);
Layout[i+20].setImageResource(R.drawable.width4);
Layout[i+20].setAdjustViewBounds(true);
tableRow.addView(rank);
tableRow.addView(Layout[i]);
tableRow.addView(Layout[i+10]);
tableRow.addView(Layout[i+20]);
t.addView(tableRow);
이 내가 만들려는 인터페이스입니다 :
이 순간에 내 코드입니다 interface
잘은 또한,
을의 실제 최고 점수와 같은 크기의 4 개 장의 사진
하지만이 경우에는 필요한 무게 명령을 잃어 버렸습니다. – TimWalter
나에게 스크린 샷을주세요 !! 코드 !! –