hog*_*gar 3 android android-custom-view android-layout android-fragments android-view
我需要在片段中实现自定义视图。到目前为止,我已经完成了扩展 View 类以在画布上绘制并将其设置为遵循google example 的活动。
我想在画布上绘制片段,问题是我不知道如何膨胀视图,因为它是对象而不是 xml 文件。
return inflater.inflate(R.layout.article_view, container, false);
Run Code Online (Sandbox Code Playgroud)
有人可以帮助我理解并解决这个问题吗?
谢谢
就这么简单:
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return new YourCustomView(container.getContext());
}
| 归档时间: |
|
| 查看次数: |
2811 次 |
| 最近记录: |