- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
这让我抓狂,我希望有人能帮我解释一下。
我的 xml 文件中有以下 XML 布局重复 3 次,一切正常,直到...我通过 <ImageView>
添加背景图像标记并将所述图像与 SeekBar 的底部对齐,我更改了 @+id 的周围,因此 imageview 具有 +。现在奇怪的是我可以对最后一个布局组执行此操作,但不能对其他任何一个布局组执行此操作。为了空间的缘故,我在这里包括了两个。后者是一种享受。但是,它将允许我将第二个(在下面的第一个列表(recordBox)中)直接放在搜索栏上方,但不在线性布局上方(我希望它在 TextView 上方,所以它在后面),这就是崩溃开始的时候。我也试过把它从最后一个上取下来,然后只戴上这个,但仍然不满意。
我刚刚注意到的另一件事是,我还可以让它与在两个 playBackSeek 引用上都具有 @+id 的 playBackBox 一起工作。
有什么想法吗?
<RelativeLayout
android:id="@+id/recordBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/intervalBox"
android:orientation="vertical"
>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/background"
android:layout_alignBottom="@+id/recordSeek"
/>
<TextView android:id="@+id/recordHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Record Duration"
android:gravity="left"
android:paddingTop="10dp"
android:layout_marginLeft="70dp"
android:textColor="#000000"
/>
<LinearLayout android:id="@+id/record2ndBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@id/recordHeader"
android:layout_alignLeft="@id/recordHeader"
>
<EditText
android:id="@+id/recordValue"
android:layout_width="75dp"
android:layout_height="40dp"
android:text="50"
android:textSize="14sp"
android:gravity="center"
android:inputType="number"
android:layout_marginRight="10dp"
/>
<Spinner android:id="@+id/recordType"
android:layout_width="140dp"
android:layout_height="40dp"
android:drawSelectorOnTop="false"
android:layout_marginTop="1dp"
/>
</LinearLayout>
<SeekBar android:id="@id/recordSeek"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="100"
android:progress="50"
android:layout_below="@id/record2ndBox"
android:layout_alignLeft="@id/recordHeader"
android:paddingBottom="20dp"
android:paddingRight="20dp"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/playBackBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/recordBox"
android:orientation="vertical"
>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/background"
android:layout_alignBottom="@+id/playBackSeek"
/>
<TextView android:id="@+id/playBackHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Play Back Duration"
android:gravity="left"
android:paddingTop="10dp"
android:layout_marginLeft="70dp"
android:textColor="#000000"
/>
<LinearLayout android:id="@+id/playBack2ndBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@id/playBackHeader"
android:layout_alignLeft="@id/playBackHeader"
>
<EditText
android:id="@+id/playBackValue"
android:layout_width="75dp"
android:layout_height="40dp"
android:text="50"
android:textSize="14sp"
android:gravity="center"
android:inputType="number"
android:layout_marginRight="10dp"
/>
<Spinner android:id="@+id/playBackType"
android:layout_width="140dp"
android:layout_height="40dp"
android:drawSelectorOnTop="false"
android:layout_marginTop="1dp"
/>
</LinearLayout>
<SeekBar android:id="@id/playBackSeek"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="100"
android:progress="50"
android:layout_below="@id/playBack2ndBox"
android:layout_alignLeft="@id/playBackHeader"
android:paddingBottom="20dp"
android:paddingRight="20dp"
/>
</RelativeLayout>
这是错误转储。
03-21 17:26:26.934: E/AndroidRuntime(621): FATAL EXCEPTION: main
03-21 17:26:26.934: E/AndroidRuntime(621): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mediabar.timelapse/com.mediabar.timelapse.TimeLapseCalculator}: java.lang.ClassCastException: android.widget.Spinner
03-21 17:26:26.934: E/AndroidRuntime(621): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
03-21 17:26:26.934: E/AndroidRuntime(621): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-21 17:26:26.934: E/AndroidRuntime(621): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-21 17:26:26.934: E/AndroidRuntime(621): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-21 17:26:26.934: E/AndroidRuntime(621): at android.os.Handler.dispatchMessage(Handler.java:99)
03-21 17:26:26.934: E/AndroidRuntime(621): at android.os.Looper.loop(Looper.java:123)
03-21 17:26:26.934: E/AndroidRuntime(621): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-21 17:26:26.934: E/AndroidRuntime(621): at java.lang.reflect.Method.invokeNative(Native Method)
03-21 17:26:26.934: E/AndroidRuntime(621): at java.lang.reflect.Method.invoke(Method.java:521)
03-21 17:26:26.934: E/AndroidRuntime(621): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-21 17:26:26.934: E/AndroidRuntime(621): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-21 17:26:26.934: E/AndroidRuntime(621): at dalvik.system.NativeStart.main(Native Method)
03-21 17:26:26.934: E/AndroidRuntime(621): Caused by: java.lang.ClassCastException: android.widget.Spinner
03-21 17:26:26.934: E/AndroidRuntime(621): at com.mediabar.timelapse.TimeLapseCalculator.onCreate(TimeLapseCalculator.java:154)
03-21 17:26:26.934: E/AndroidRuntime(621): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-21 17:26:26.934: E/AndroidRuntime(621): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
按要求创建
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); //anim is coming in, going out
overridePendingTransition(R.anim.pull_right_in, R.anim.push_left_out);
setContentView(R.layout.calculator);
HDDResults = (TextView)findViewById(R.id.HDDResults);
timeResults = (TextView)findViewById(R.id.TimeResults);
extraResults = (TextView)findViewById(R.id.ExtraResults);
HDDResults.setText("HDD:");
timeResults.setText("time Results Area:");
extraResults.setText("Extra Results Area:");
radioGroup = (RadioGroup) findViewById(R.id.calcBy);
rb1 = (RadioButton) findViewById(R.id.byInterval);
rb2 = (RadioButton) findViewById(R.id.byRecord);
rb3 = (RadioButton) findViewById(R.id.byPlayBack);
radioGroup.setOnCheckedChangeListener(this);
intSeek = (SeekBar)findViewById(R.id.intervalSeek);
intSeek.setOnSeekBarChangeListener(this);
intTextValue = (EditText)findViewById(R.id.intervalValue);
intTextValue.setOnFocusChangeListener(this);
intTextValue.addTextChangedListener(this);
intType=(Spinner)findViewById(R.id.intervalType);
intType.setOnItemSelectedListener(this);
ArrayAdapter<String> intTypelist=new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,intTypeItems);
intTypelist.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
intType.setAdapter(intTypelist);
recSeek = (SeekBar)findViewById(R.id.recordSeek);
recSeek.setOnSeekBarChangeListener(this);
recTextValue = (EditText)findViewById(R.id.recordValue);
recTextValue.setOnFocusChangeListener(this);
recTextValue.addTextChangedListener(this);
recType=(Spinner)findViewById(R.id.recordType);
recType.setOnItemSelectedListener(this);
ArrayAdapter<String> recTypelist=new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,recTypeItems);
recTypelist.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
recType.setAdapter(recTypelist);
playSeek = (SeekBar)findViewById(R.id.playBackSeek);
playSeek.setOnSeekBarChangeListener(this);
playTextValue = (EditText)findViewById(R.id.playBackValue);
playTextValue.setOnFocusChangeListener(this);
playTextValue.addTextChangedListener(this);
playType=(Spinner)findViewById(R.id.playBackType);
playType.setOnItemSelectedListener(this);
ArrayAdapter<String> playTypelist=new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,playTypeItems);
playTypelist.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
playType.setAdapter(playTypelist);
}
最佳答案
尝试项目 > 如果您使用的是应该可以解决所有问题的 eclipse,请进行清理。如果没有重新启动eclipse。在有人告诉我这是 xml 文件构建其组件的方式之前,我遇到了这样的问题。它可能混淆了。
关于Android: Activity 启动时发生奇怪的崩溃。处理 XML 布局排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9809845/
每当我运行命令以将 Virtualbox 驱动程序启动 Minishift 到操作系统主机时,它都需要一段疯狂的时间,而且它永远不会结束。有时我什至收到有关达到存储限制的错误消息。 不知道是不是描述h
您好,我正在使用 npm 运行一个基本的 React 项目,我正尝试在 docker 容器中启动它。但是我实际上无法让项目运行。我的 dockerfile 看起来像这样: FROM node:7.8.
所以我想从我的 SSH 终端开始游戏。 这真的很奇怪,当我直接从 Linux GUI 执行此操作时,它可以工作。但是当我使用 SSH 客户端进行远程连接时,它就崩溃了。似乎与我的显示驱动程序有关。 U
我有一个显示图像的动态壁纸。我在 Activity 中更改了该图像。然后我需要通知动态壁纸,以便它知道重新加载资源。 Intent 似乎是完美、简单的解决方案: Intent intent = new
我有一个似乎无法解决的问题。我在 Boot Dashboard 中使用 STS 3.9.2 从 Eclipse (Oxygen) 启动 Spring Boot 应用程序没有任何问题: 但是,当我尝试从
全新的 Python,在我开始摆弄东西之前先设置和安装东西。我的理解是 Python 2.7 和 Python 3.3 之间存在一些显着差异/不兼容,尽管这两个版本都得到了很好的使用,所以我认为最好安
在使用了很长时间的 jQuery 之后,我有一个问题,我正在使用 jQuery 模式(样式)编写一个简单的代码, (function(window, undefined) { var jQu
我正在尝试在 spring boot 应用程序下的非 spring 托管类中配置 Autowired。我在 tomcat 服务器下部署的 Web 应用程序下成功运行了这个。但是当我想在 spring
我对 xmonad 完全陌生,但我想开始使用它来提高我的工作效率。 这是我一直在使用的指南(我使用的是 Apple OS X Snow Leopard) http://xmonad.org/tour.
我试图将Spring Boot指南中的Managing Transactions示例扩展到两个数据源,但是@Transaction注释似乎仅对其中一个数据源有效。 在“Application.java
conEmu 有没有办法默认打开多个不同的选项卡? 我看到这个页面解释了如何使用 splits , 我意识到我可以按 Ctrl + T, 1, Enter,但我希望有一种方法可以自动执行此操作! "%
我正在寻找快速而肮脏的答案。我当时脑子一片空白,盯着屏幕看了 12 个小时以上,我想我中枪了。 我想做一个简单的 SignalR 应用程序作为教程。我找到了这个example ,但我不断收到票证未定义
我正在使用 Azure Powershell cmdlet 来启动/停止 VM。 Start-AzureVM [-ServiceName] [-Name] [ ] Stop-AzureVM [-S
我想使用Powershell脚本代码启动/停止iis和mssql 意味着当我运行ps脚本时,我想启动/停止iis和mssql 我在网上搜索了它,发现了一些代码,但按照我的要求无法正常工作 码: $ii
我在 liferay 工作。我们在我们的项目中使用一个模块来创建 liferay 主题。我使用命令 ant -Ddeploy.war=true 将它部署在服务器中。 war 文件在 liferay 部
我想在已安装 Python 2.7 的 Windows XP 计算机上运行 IPython(版本 0.12)。 我通过 Windows 二进制安装程序安装,但安装后 IPython 没有显示在菜单中,
我从创建了自己的简单图片。 FROM python:2.7.11 RUN mkdir /extra/later/ \ && mkdir /yyy 现在,我可以执行以下步骤: docker run
$(document).ready(function () { setTimeout(function() { window.location.reload(); }, 2000); // 2
我刚刚创建了一个帐户 OpenWeatherMap 我想通过城市 ID API 调用获取当前位置的天气: http://api.openweathermap.org/data/2.5/weather?
我注意到,如果我更改 xcasset 中的图像,启动 Storyboard不会更新。 例如,假设您的启动 Storyboard中有一个 UIImage View ,其中包含一个名为“logo”的蓝色图
我是一名优秀的程序员,十分优秀!