开发者

Copy android.R.layout to my project

Good advice from CommonWare and Steve H but it's not as easy to me as I first thought.

Based on their advice I'm trying to copy android.R.layout to my project to ensure consistency. How do you do this?

I looked in Eclipse's Package Explorer and under Android 1.5>android.jar>android>R.class>R>layout and find R$layout.class.

Do I copy the code out of there into my own class? From my very limited knowledge of Java, the following code doesn't make much sense:

public static final class android.R$layout {

  // Field descriptor #8 I
public static final int activ开发者_StackOverflowity_list_item = 17367040;

// Field descriptor #8 I
public static final int browser_link_context_header = 17367054;

// Field descriptor #8 I
public static final int expandable_list_content = 17367041;

// Field descriptor #8 I
public static final int preference_category = 17367042;

// Field descriptor #8 I
public static final int select_dialog_item = 17367057;

// Field descriptor #8 I
public static final int select_dialog_multichoice = 17367059;

// Field descriptor #8 I
public static final int select_dialog_singlechoice = 17367058;

// Field descriptor #8 I
public static final int simple_dropdown_item_1line = 17367050;

// Field descriptor #8 I
public static final int simple_expandable_list_item_1 = 17367046;

// Field descriptor #8 I
public static final int simple_expandable_list_item_2 = 17367047;

// Field descriptor #8 I
public static final int simple_gallery_item = 17367051;

// Field descriptor #8 I
public static final int simple_list_item_1 = 17367043;

// Field descriptor #8 I
public static final int simple_list_item_2 = 17367044;

// Field descriptor #8 I
public static final int simple_list_item_checked = 17367045;

// Field descriptor #8 I
public static final int simple_list_item_multiple_choice = 17367056;

// Field descriptor #8 I
public static final int simple_list_item_single_choice = 17367055;

// Field descriptor #8 I
public static final int simple_spinner_dropdown_item = 17367049;

// Field descriptor #8 I
public static final int simple_spinner_item = 17367048;

// Field descriptor #8 I
public static final int test_list_item = 17367052;

// Field descriptor #8 I
public static final int two_line_list_item = 17367053;

// Method descriptor #50 ()V
// Stack: 3, Locals: 1
public R$layout();
 0  aload_0 [this]
 1  invokespecial java.lang.Object() [1]
 4  new java.lang.RuntimeException [2]
 7  dup
 8  ldc <String "Stub!"> [3]
10  invokespecial java.lang.RuntimeException(java.lang.String) [4]
13  athrow
  Line numbers:
    [pc: 0, line: 899]
  Local variable table:
    [pc: 0, pc: 14] local: this index: 0 type: android.R.layout

Inner classes:
 [inner class info: #5 android/R$layout, outer class info: #64 android/R
  inner name: #55 layout, accessflags: 25 public static final]
 }


You should copy the layout package/folder with the XML file contents.

Android 1.5/android.jar/res/layout

R.class is automatically generated for your layout files.


Layout files are converted to a binary format. I believe the R file is basically a list of the memory locations of different entities corresponding to a descriptor. So you can't just copy over the R file, you need to move over the package containing the xml and let the R file be generated for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜