我正在尝试使用 4 个片段
\n\n[F1]
\n\n[F2][F3][F4]
\n\nF1 将有 3 个按钮可在 F2、F3 和 F4 之间切换,但我不\xc2\xb4t 知道如何像在正常活动中一样使用按钮属性
\n\n这就是我的 F1 代码中的内容
\n\n@Override\npublic View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n // Inflate the layout for this fragment\n\n return inflater.inflate(R.layout.fragment_01, container, false);\n\n}\nRun Code Online (Sandbox Code Playgroud)\n
检查一下:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_01, container, false);
// here you have the reference of your button
Button yourButton = (Button)view.findViewById(R.id.your_button_id);
return view;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1009 次 |
| 最近记录: |