2012-09-19 7 views
0

TextView에서 Android LayoutParams에 문제가 있습니다. 크기 200 딥 x 200 딥의 상자에 텍스트를 표시하고 싶습니다. 그러나 아무것도 보이지 않고있다.Android LayoutParams do nothing

tr = new TableRow(this); 
TextView phone = new TextView(this); 
phone.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE); 
phone.setLines(20); 
phone.setText(Html.fromHtml("<b>Beschreibung</b><br /><br />")); 
phone.append(poi.getDescription()); 
tr.addView(phone,new ViewGroup.LayoutParams(calculatePxs(200),calculatePxs(200))); 
     tr.setPadding(10, 15, 10, 15); 

v = new View(this); 
v.setBackgroundColor(Color.rgb(51, 51, 51)); 

table.addView(tr,new TableLayout.LayoutParams(
       LayoutParams.WRAP_CONTENT, 
       LayoutParams.WRAP_CONTENT)); 

table.addView(v,new TableLayout.LayoutParams(
       LayoutParams.WRAP_CONTENT, 
       1)); 

답변

0

대신

new ViewGroup.LayoutParams(calculatePxs(200),calculatePxs(200))); 
    tr.setPadding(10, 15, 10, 15); 

사용 TableRow.LayoutParams

처럼 : 작동

new TableRow.LayoutParams(calculatePxs(200),calculatePxs(200))); 
tr.setPadding(10, 15, 10, 15); 
+0

좋아요 이것은 코드입니다. 그러나 TextView는 텍스트가 테두리에 도달 할 때 줄 바꿈을 사용합니다. 왜 그런지 알아? – Bene

+0

이 게시물을 사용해보십시오 : http://stackoverflow.com/questions/4831529/android-single-line-textview-without-the-dots –

+0

이미 시도했지만 성공하지 못했습니다 ... – Bene

관련 문제