안드로이드 개발 질문/답변
(글 수 45,052)
AlertDialog을 이용 해서 창을 띄어 줄떄 그 내용의 글자 정렬을 하고 싶습니다.
위와 같이 했을떄 message에 text를 set 하는데요.
View view = this.getLayoutInflater().inflate(R.layout.test_view, null); TextView message = (TextView) view.findViewById(R.id.message); message.setTextSize(15); message.setText(str); AlertDialog.Builder ab=new AlertDialog.Builder(Test.this); ab.setView(view); ab.setNegativeButton("CANCLE", null); ab.show();
str에 현재
str = "==== Information =====\n";
str += "aaa : bbbb"\n";
str += "aaaaaaaa : bbbb"\n";
str += "aaaaaaaaaaaaa : bbbb"\n";
str += "=========================";
이런식으로 되어있을떄 그냥 log로 찍어 보면 정렬 되서 딱딱 나오는데...
이게 dialog에 들어가면 정렬이 되어 나오지 않고
==== Information =====
aaa : bbbb"\n";
aaaaaaaa : bbbb"\n";
aaaaaaaaaaaaa : bbbb"
=========================
이런식으로 나옵니다.. 이걸 똑바로 정렬 되게 나오게 하고 싶은데 어떻게 해야 할까요?
자답입니다.
view에 textview에서 폰트를 지정 해주니 해결 되네요.
android:typeface로 지정해주시면 됩니다.