我正在为android电视创建一个新项目。我没有书面代码。我无法修改应用程序的设计
error message: unknown fragment
错误的更多详细信息:
A <fragment> tag allows a layout file to dynamically include different layouts at runtime. At layout editing time the specific layout to be used is not known. You can choose which layout you would like previewed while editing the layout.
错误图像
xml代码:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_browse_fragment"
android:name="com.example.milchycompany.myapplication.MainFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:deviceIds="tv"
tools:ignore="MergeRootFrame" />
代码MainActivity
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
请帮助以能够创建我的第一个android电视应用程序
我猜您的com.example.milchycompany.myapplication.MainFragment是从BrowseFragment扩展的。该片段动态地包含了Leanback库中一部分的布局,例如R.layout.lb_browse_fragment以及用于以编程方式生成其他布局的适配器。因此,它不适合在布局编辑器中进行编辑。相反,您可以调用各种设置器来调整用户界面,例如