我正在开发7英寸屏幕和htc m8。我有很多运行正常的布局xml文件。我有一个片段正在创建问题。我在清单中以横向模式设置的三星7英寸屏幕上运行它。
我的平板电脑像魅力一样运行。然后我在layout-land中复制我的大地文件并尝试在htc上运行我的代码。我已经多次完成这个方法了。
但是在运行inflater.inflate时我遇到了崩溃。
xml中一定有问题吗?堆栈跟踪和我的布局xml文件已加入。 我被卡住了。有任何想法吗? 我没有看到任何迹象表明这个问题。
我将堆栈添加为jpg,因为stackoverflow不喜欢我的格式。
布局文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/LightSkyBlue"
tools:context="com.example.bernard.speechparole.Cards">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="@+id/title_cards_ex"
android:layout_centerHorizontal="true"/>
<ImageView
android:id="@+id/image"
android:layout_height="190dp"
android:layout_width="350dp"
android:layout_marginTop="30dp"
android:layout_below="@id/title_cards_ex"
android:layout_toRightOf="@+id/help"
android:layout_marginLeft="40dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/work_validation"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/pro_validation"
android:layout_below="@+id/title_cards_ex"
android:layout_marginTop="65dp"
android:layout_marginLeft="20dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/next"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/next"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/work_validation"
android:layout_alignBottom="@id/work_validation"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/help"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/help"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/next"
android:layout_alignBottom="@id/next"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/done"
android:textSize="40dp"
android:visibility="invisible"
android:text="@string/done"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/work_answer"
android:layout_below="@+id/work_validation"
android:textSize="30dp"
android:background="@drawable/round_corner"
android:layout_alignLeft="@+id/work_validation"
android:ems="7"
android:layout_marginTop="15dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/resp_card"
android:textSize="29dp"
android:textColor="@color/DarkBlue"
android:textStyle="bold"
android:id="@+id/resp_card"
android:layout_marginTop="40dp"
android:layout_alignLeft="@id/work_validation"
android:visibility="invisible"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/mem_report"
android:id="@+id/report_card"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_below="@id/work_answer"
android:layout_alignLeft="@id/work_validation"
android:layout_marginTop="25dp"/>
</RelativeLayout>
答案 0 :(得分:0)
问题在于您的字符串或可绘制资源之一。检查异常中资源的id,并在R.java
中搜索它,找出导致问题的资源,或者只是看看XML中是否有红色突出显示。