문자열의 길이에 따라 gridView를 만들려고합니다. 내가 15는 containes의 tableview를 craeted - 나는 이전에 C#에서 비슷한 짓을했고 문자열에 공백이 없음을 가정 ...안드로이드의 gridView에 동적으로 textView를 추가합니다.
- 밑줄 -
모든 텍스트 뷰는 하나의 문자를 표시해야합니다 lables, 그리고 글자 수를 기준으로, 각각 오른쪽으로 옮겼습니다.
public void setLetters(String str)
{
tableLayoutPanel1.Visible = false;
int x = revah(str); //revah returns the number of letters in the string
int yy = x/2;
int count = 0;
if (count <= x)
{
tableLayoutPanel1.SetColumn(lbl0, yy);
count++;
}
if (count <= x)
{
tableLayoutPanel1.SetColumn(lbl1, yy);
count++;
}
if (count <= x)
{
tableLayoutPanel1.SetColumn(lbl2, yy);
count++;
}
if (count <= x)
{
tableLayoutPanel1.SetColumn(lbl3, yy);
count++;
}
if (count <= x)
{
tableLayoutPanel1.SetColumn(lbl4, yy);
count++;
}
if (count <= x)
{
tableLayoutPanel1.SetColumn(lbl5, yy);
count++;
}
if (count <= x)
{
tableLayoutPanel1.SetColumn(lbl6, yy);
count++;
}
if (count <= x)
{
tableLayoutPanel1.SetColumn(lbl7, yy);
count++;
}
if (count <= x)
{
tableLayoutPanel1.SetColumn(lbl8, yy);
count++;
}
if (count <= x)
{
tableLayoutPanel1.SetColumn(lbl9, yy);
count++;
}
if (count <= x)
{
tableLayoutPanel1.SetColumn(lbl10, yy);
count++;
}
if (count <= x)
{
tableLayoutPanel1.SetColumn(lbl11, yy);
count++;
}
if (count <= x)
{
tableLayoutPanel1.SetColumn(lbl12, yy);
count++;
}
if (count <= x)
{
tableLayoutPanel1.SetColumn(lbl13, yy);
count++;
}
if (count <= x)
{
tableLayoutPanel1.SetColumn(lbl14, yy);
count++;
}
tableLayoutPanel1.Visible = true;
}
나는 방법도 ... 도움을 시작할 수있는 gridview를 사용하여 안드로이드에서 비슷한 일을 수행하고자하지만, 아무 생각이 ...
textview 값이 helloworld 인 것처럼 halloworld를 gridview에 표시하려는 것보다 h l l l o w l r l d? 내가 뭘 했니? – Zohaib
음 ... 정확하지는 않지만 ... 저에게 어떻게하는지 보여 주시면, 아프세요 : – omi
코드를 더 간단하게 만들 수있는 방법이 보이지 않습니까? :) –