特定の@ViewByIdの直後で、他の@ViewByIdの前にメソッドを実行できるかどうかを知りたいです。
@ViewById
CostumView view1;
@ViewById
ListView list;
void myMethod(){
view1.set...
}
また、最初の注射を最初に強制する方法を知りたいです。
ありがとう。
AAのないコードでは、メインとファンのレイアウトは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);
リストがメインレイアウトまたはファンレイアウトにある場合、MyActivity_のfindViewByIdはnullを返します:)
(@AfterViewsを使用する場合)生成されるコードは次のようになります:
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);