Exemplo n.º 1
0
    public View inflate(Context context, View parent) throws Exception {
      View view = create(context, (ViewGroup) parent);

      for (ViewNode child : children) {
        child.inflate(context, view);
      }

      invokeOnFinishInflate(view);
      return view;
    }
Exemplo n.º 2
0
 private View inflateView(
     Context context, String layoutName, Map<String, String> attributes, View parent) {
   ViewNode viewNode = getViewNodeByLayoutName(layoutName);
   if (viewNode == null) {
     throw new RuntimeException("Could not find layout " + layoutName);
   }
   try {
     if (attributes != null) {
       for (Map.Entry<String, String> entry : attributes.entrySet()) {
         if (!entry.getKey().equals("layout")) {
           viewNode.attributes.put(entry.getKey(), entry.getValue());
         }
       }
     }
     return viewNode.inflate(context, parent);
   } catch (I18nException e) {
     throw e;
   } catch (Exception e) {
     throw new RuntimeException("error inflating " + layoutName, e);
   }
 }