나는 원어민 아니에요.
목적을 달성하려면 다음 단계를 따라야합니다. 1. 기기의 크기를 찾으십시오. 이전에이 작업을 수행 했으므로 여기에 구현했습니다. 당신은 장치의 크기가되면
protected void loadDeviceDimensions(){
Point size = new Point();//Calcular Width y Height.
WindowManager w = getWindowManager();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2)
{
w.getDefaultDisplay().getSize(size);
DeviceWidth = size.x;
DeviceHeight = size.y;
}
else
{
Display d = w.getDefaultDisplay();
DeviceWidth = d.getWidth();
DeviceHeight = d.getHeight();
}
}
- 다음 단계는 텍스트 필드, 텍스트, 글꼴, 그리고 다른 모든 물건을 만드는 것입니다. 위치에 대해 걱정하지 마시고, 필드를 만드십시오.
- 텍스트 및 글꼴 세트로 필드를 작성한 후에는 위치를 설정해야합니다. 이러한 목적을 위해 TextView.getWidth() 및 TextView.getHeight()를 사용해야합니다. 코드는 다음과 같아야합니다.
for(int i=0, i < textView-1 , i++) {
if(textViews[i].getWidth <= deviceWidth/2 && textViews[i+1].getWidth <= deviceWidth/2){
//Put the two text fields on the same line
i++;//Don't forget this line.
}else{
//Put only one text field on the line.
}
}