レイアウト ファイルのブロックで宣言され、アクティビティに挿入されたフラグメントを Roboguice で操作できるようにしようとしました<fragment>が、フラグメントは画面外のどこかに存在しますが (EditTextフラグメント内の がフォーカスを取得してイベントを発生させます)、それは見えません。RoboGuice は、私がここでやろうとしていることをサポートしていますか、それとも別の方法で行うべきですか?
コード:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/myFragment"
android:name="com.example.MyFragment"
android:layout_height="0dp"
android:layout_width="0dp"
android:layout_weight="1" >
<!-- Preview: layout=@layout/my_fragment -->
</fragment>
</LinearLayout>
ジャワ:
@ContentView(R.layout.participant)
public final class Main extends RoboFragmentActivity {
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@InjectFragment(R.id.myFragment) private MyFragment myFragment;
}