【发布时间】:2021-03-28 16:05:06
【问题描述】:
我的设备上有文件 xml android ui 我想在应用程序上读取这个文件
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:background="@color/color_primry2"
android:layout_height="match_parent"
tools:context=".Home_splash">
</RelativeLayout>
喜欢这个
File file = "Element/0/....../RelativeLayout .xml"
View view = file ;
setcontentview(view);
重要提示,这不是真正的代码,但这是解释我想要什么的代码
【问题讨论】:
-
你应该把它添加到你项目的/layout文件夹中
-
还有其他方法可以解决这个问题吗?
-
@kerolsnaguib 你想在项目目录外加载xml文件吗?
-
@Thân LƯƠNG 是的