Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 布局大于设备屏幕导致应用程序崩溃_Java_Android_Xml_Layout - Fatal编程技术网

Java 布局大于设备屏幕导致应用程序崩溃

Java 布局大于设备屏幕导致应用程序崩溃,java,android,xml,layout,Java,Android,Xml,Layout,我目前正在开发的一款移动应用程序出现问题。其背后的思想是显示传递对象中各种变量的值。由于我需要向布局xml文件中添加越来越多的对象以显示所有内容,因此预览已停止显示除操作栏之外的任何对象,并尝试使用此布局启动活动会使应用程序崩溃 我有一种感觉,这可能是由于布局比虚拟设备屏幕大,尽管可能还有另一个原因我完全不知道。在此问题上的任何帮助都将不胜感激。此活动当前使用相对布局,是否可以解决将相对布局包装在滚动视图中以使活动可滚动的问题 <?xml version="1.0" encoding="u

我目前正在开发的一款移动应用程序出现问题。其背后的思想是显示传递对象中各种变量的值。由于我需要向布局xml文件中添加越来越多的对象以显示所有内容,因此预览已停止显示除操作栏之外的任何对象,并尝试使用此布局启动活动会使应用程序崩溃

我有一种感觉,这可能是由于布局比虚拟设备屏幕大,尽管可能还有另一个原因我完全不知道。在此问题上的任何帮助都将不胜感激。此活动当前使用相对布局,是否可以解决将相对布局包装在滚动视图中以使活动可滚动的问题

<?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:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:text="Name"
    android:id="@+id/RequestNameTextView"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />

<TextView
    android:id="@+id/RequestNameDisplay"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/RequestNameTextView"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_margin="10dp"
    android:textAppearance="?android:attr/textAppearanceMedium"  />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:text="Student ID"
    android:id="@+id/RequestStudentIDTextView"
    android:layout_below="@+id/RequestNameDisplay"/>

<TextView
    android:id="@+id/RequestStudentIDDisplay"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/RequestStudentIDTextView"
    android:layout_margin="10dp"
    android:textAppearance="?android:attr/textAppearanceMedium"  />

<TextView
    android:id="@+id/RequestLocationTextView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/RequestStudentIDDisplay"
    android:text="Location"
    android:textAppearance="?android:attr/textAppearanceMedium"
     />

<TextView
    android:id="@+id/RequestLocationDisplay"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/RequestLocationTextView"
    android:layout_margin="10dp"
    android:textAppearance="?android:attr/textAppearanceMedium"  />

<TextView
    android:id="@+id/RequestProblemTextView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/RequestLocationDisplay"
    android:text="Problem Description"
    android:textAppearance="?android:attr/textAppearanceMedium"
    />

<TextView
    android:id="@+id/RequestProblemDisplay"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/RequestProblemTextView"
    android:layout_margin="10dp"
    android:textAppearance="?android:attr/textAppearanceMedium"  />

<TextView
    android:id="@+id/RequestStatusTextView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/RequestProblemDisplay"
    android:text="Current Status"
    android:textAppearance="?android:attr/textAppearanceMedium"
    />

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/RequestStatusDisplay"
    android:layout_below="@+id/RequestStatusTextView"
    android:layout_margin="10dp"
    android:textAppearance="?android:attr/textAppearanceMedium"/>

<TextView
    android:id="@+id/RequestAssignmentTextView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/RequestStatusDropDown"
    android:text="Assigned To"
    android:textAppearance="?android:attr/textAppearanceMedium"
    />

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/RequestAssignmentDisplay"
    android:layout_below="@+id/RequestAssignmentTextView"
    android:layout_margin="10dp"
    android:textAppearance="?android:attr/textAppearanceMedium"/>

<TextView
    android:id="@+id/RequestStatusUpdateTextView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/RequestAssignmentDisplay"
    android:text="Update Status to:"
    android:textAppearance="?android:attr/textAppearanceMedium"
    />

<Spinner
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/RequestStatusDropDown"
    android:layout_below="@+id/RequestStatusUpdateTextView"
    android:layout_margin="10dp"
    android:textAppearance="?android:attr/textAppearanceMedium"/>

<TextView
    android:id="@+id/RequestAssignmentUpdateTextView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/RequestStatusDropDown"
    android:text="Assign Request To:"
    android:textAppearance="?android:attr/textAppearanceMedium"
    />

<Spinner
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/RequestAssignmentDropDown"
    android:layout_below="@+id/RequestAssignmentUpdateTextView"
    android:layout_margin="10dp"
    android:textAppearance="?android:attr/textAppearanceMedium"/>

<Button
    android:id="@+id/RequestSaveChangesButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:text="Save Changes" />
</RelativeLayout>


这是因为您的相对布局具有循环依赖关系。从RequestAssignmentTextView到RequestStatusDropDown,您有一个循环依赖关系。只需更改RequestAssignmentTextView的“下方”元素即可避免此错误。

什么是错误日志?谢谢,测试后,这似乎可以解决问题。我相信你能够理解循环依赖,尽管没有异常细节,我想我应该在凌晨4点寻求帮助时更加小心!