问题描述:

I'd like to know if it's possible to execute a methode directly after a specific @ViewById and before others @ViewById.

@ViewById

CostumView view1;

@ViewById

ListView list;

void myMethod(){

view1.set...

}

also I'd like to know how can I force the first injection to be the first.

thanks.

code without AA

the main and fan layouts must be set only by java .

private FanView fan;

private ListView list;

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.test);

fan = (FanView) findViewById(R.id.fan_view);

fan.setViews(R.layout.main, R.layout.fan);

list=(ListView)findViewById(R.id.list);

if the list is in the main or fan layout the findViewById of MyActivity_ returns null :)

(if I use @AfterViews) the generated code will be somthing like that :

 setContentView(R.layout.test);

fan = (FanView) findViewById(R.id.fan_view);

list=(ListView)findViewById(R.id.list);//returns null

fan.setViews(R.layout.main, R.layout.fan);

网友答案:

There is no annotation allowing to execute an instruction between the injections of views, because the official documentation specify that injection are made as soon as possible.

they should make an annotation

@afterView(R.id.myView)
相关阅读:
Top