ActionBarSherlock のフラグメントとビューに問題があります。
2 つのタブを正常に実装し、タブでフラグメント ビューを開きます。
public class AFragment extends SherlockFragment {
private ImageButton imageButton1;
private ImageButton imageButton2;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.activity_afragment, container, false);
}
}
これは私のコードです。レイアウトには TextView と 2 つの ImageButtons が表示されます。imagebutton = (ImageButton) findViewById(R.id.imagebutton1); のように画像ボタンを宣言したい しかし、それはfindViewByIdでエラーになります。AFragment アクティビティ内のすべての位置で試しましたが、それでも同じエラーが発生します。OnCreate 関数も追加しようとしましたが、これも機能しません...そのビューを機能させるには、どこにコードを配置する必要がありますか? ありがとうございました!