【发布时间】:2015-06-04 12:48:06
【问题描述】:
下面是xml代码sn-p。未对 MainActivity.java 进行任何更改。我已经开始制作一个计算器并完成了设计部分,但是当我尝试运行这个应用程序(在各种实际设备上)时,Android Studio 的 logcat 显示 - 'Too much output to process' 并且它强制关闭设备(实际设备,而不是模拟器)。我使用了 shape.xml 和 strings.xml 文件。没有其他的!
MainActivity.xml 文件
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:id="@+id/asdjk"
android:background="#ffc8c8c8">
<Button
android:layout_width="@string/w"
android:layout_height="@string/h"
android:id="@+id/clearButton"
android:background="@drawable/shape"
android:clickable="true"
android:text="@string/clearButtonString"
android:textColor="#FFC85D00"
android:textSize="30sp"
android:layout_above="@+id/sevenButton"
android:layout_toLeftOf="@+id/fiveButton"
android:layout_toStartOf="@+id/fiveButton"
/>
<!-- lots of other buttons -->
</RelativeLayout>
Shape.xml 文件
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffffff"/>
<!--
<corners android:radius="10dp"/>
-->
<stroke
android:width="1px"
android:color="#ffc8c8c8" />
</shape>
【问题讨论】:
-
您正在尝试将
Button的layout_height映射到字符串资源?我觉得应该是维度类型。
标签: android xml android-studio android-logcat