Sunday 15 April 2012

Android;Body of ProgressDialog? -


I saw the layout of this source in the AlertDialog res \ layout Folder of Android SDK in the form:

  & lt; FrameLayout xmlns: android = "http://schemas.android.com/apk/res/android" Android: layout_width = "match_parent" Android: layout_height = "wrap_content" & gt; & Lt; LinearLayout android: id = "@ + id / body" android: orientation = "horizontal" android: Layout_width = "Match_parent" Android: Layout_height = "Match_parent" Android: baselineAligned = "false" Android: paddingLeft = "8dip" Android: PaddingTop = "10dip" Android: paddingRight = "8dip" Android: paddingBottom = "10dip" & gt; & Lt; ProgressBar android: id = "@ android: id / progress" style = "@ android: style / WidgetkProgressBar" Android: Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" Android: max = "10000" Android: Layout_marginRight = "12dip" /> & Lt; TextView android: id = "@ + id / message" Android: layout_width = "match_parent" Android: layout_height = "wrap_content" Android: layout_gravity = "center_vertical" / & gt; & Lt; / LinearLayout & gt; & Lt; / FrameLayout & gt;   

I tried it ID that TextView to the "message" of:

  TextView tvMessage = (TextView) dialog.findViewById (android .R. id.message);   

This works fine. Then I think LinearLayout that this id is "body" tried this way:

  LinearLayout body = (LinearLayout) dialog.findViewById (android.R.id.body);   

But eclipse shows this error: body can not be solved or there is no field

This is the snippet code:

  progress dialog = new progress DIOO (WriteOperinactivity.This); Dialog.setMessage ("some text"); Dialog.show (); TextView tvMessage = (TextView) dialog.findViewById (android.R.id.message); LinearLayout body = (LinearLayout) dialog.findViewById (android.R.id.body);   

Why is this error and how can I access the "body"?

Actually, you can not access all of the resource platform res Are there.

Example I @ + id / message code> global_actions_item.xml, usb_storage_activity.xml, alert_dialog_holo.xml, js_prompt.xml, progress_dialog_holo.xml, progress_dialog.xml, alert_dialog I'm able to find .xml (for API 17), and therefore, there is no warranty that you get the id defined in the progress_dialog.xml (It can be defined in another file and only because of that name you can find it in the progress dialog).

Actually, public resources are defined, however, it looks very old, so some resources can be remembered. Check these questions about lists of all accessible resources: and

No comments:

Post a Comment