안드로이드는 나는 그것의 텍스트 값을 설정하는 텍스트 뷰를 전망하지만 AlertDialog를 구축하고 액세스 할 수 트링하고있다.문제 가져 오는 중 오류 구성 요소 -
private void ShowLogDialog() {
AlertDialog ad = new AlertDialog.Builder(this).create();
ad.setIcon(R.drawable.icon);
ad.setTitle("Ultimate Logs");
ad.setView(LayoutInflater.from(this).inflate(R.layout.log_layout, null));
TextView text = (TextView)ad.findViewById(R.id.logTextView_log); // RETURNS NULL
//Log.i(TAG, "Into ShowLogDialog : GoT TextView = " + text);
//String logsText = "";
//text.setText(logsText);
ad.setButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
ad.show();
}
log_layout.xml
<LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:scrollbars="vertical" android:scrollbarAlwaysDrawVerticalTrack="true" xmlns:android="http://schemas.android.com/apk/res/android">
<TextView android:layout_height="wrap_content" android:text="TextView" android:id="@+id/**logTextView_log**" android:layout_width="wrap_content"></TextView>
</LinearLayout>
왜 내가 텍스트 뷰에 액세스 할 수 없습니다 : 여기에 코드입니까? null를 돌려 주어, NullPointerException를 Throw합니다. findBiewById를 사용하여 직접 액세스 할 수 없으므로 ad.findViewById를 사용하고 있지만 null 만 수신합니다. 아무도 내가 잘못 가고 있다는 것을 알 수 있도록 도와 줄 수 있습니까?
감사합니다.
AlertDialog의 텍스트 글꼴 크기를 설정할 수있는 방법이 있습니까? 내 말은, SetMessage()에 추가 된 텍스트의 크기를 변경할 수 있습니까? 이것이 성취 될 수 있다면, 또한 나의 일을 할 수 있습니다. – Tvd