参数化ID名称

时间:2018-10-29 02:40:05

标签: android kotlin id

是否有更好的方法?希望缩短行吗?

{!this.state.isEdit &&
   <Todo
     onCompleted={this.handleCompleted}
     todos={this.state.todos}
     onEdit={this.handleEdit}
     onDelete={this.handleDelete}

   />
   }

   {this.state.isEdit &&
    <Useredit
      onCompleted={this.handleCompleted}
      onEdit={this.handleEdit}
      value={this.state.editText} 
      onChange={this.handleEditChange} 
      onChangeSelect={this.handleSelectChange}
      todos={this.state.todos}
      onDelete={this.handleDelete}
      onSave={this.handleSave}

      /> 
    }

类似的东西:

 when (tabKey) {
        1 -> {
            learnHeader!!.id        = R.id.learnHeader1
            learnSwipeRefresh!!.id  = R.id.learnSwipeRefresh1
        }

        2 -> {
            learnHeader!!.id        = R.id.learnHeader2
            learnSwipeRefresh!!.id  = R.id.learnSwipeRefresh2           
        }
}

1 个答案:

答案 0 :(得分:1)

尝试....

File file = new File("C:/test.xml");
Object xmlIPSlup = new XmlSlurper().parse(file);

希望它能帮助您.....