Android 在eclipse模板中获取类类型

Android 在eclipse模板中获取类类型,android,eclipse,templates,code-snippets,Android,Eclipse,Templates,Code Snippets,我正在学习为eclipse制作片段。我的想法是制作一些快速findViewById,因此当您声明一个var时,代码段将获取var的类型和名称,并编写其余的代码 如果你写信 Button myButton findView 代码段应获取类(Button)和名称(myButton),并写入: = (Button) findViewById(R.id.myButton); 我做得很好,但我不能得到按钮类。有什么帮助吗?我的代码是 = ($type)findViewById(R.id.${name:

我正在学习为eclipse制作片段。我的想法是制作一些快速findViewById,因此当您声明一个var时,代码段将获取var的类型和名称,并编写其余的代码

如果你写信

Button myButton findView
代码段应获取类(Button)和名称(myButton),并写入:

= (Button) findViewById(R.id.myButton);
我做得很好,但我不能得到按钮类。有什么帮助吗?我的代码是

= ($type)findViewById(R.id.${name:var});
${cursor}
你应该试试这个:

${type} ${new_name} = (${type})findViewById(R.id.${name});${cursor}

我把新的名字换成了新的名字,它或多或少做了我想做的事!非常感谢。