我试图在按下按钮后按钮向下移动到屏幕底部.
我有完美的动画效果,但动画结束后按钮不会停留在屏幕的底部.我尝试过使用offsetTopAndBottom()它,但它只停留在那里一帧,并在顶部重绘.我怎样才能按住按钮?
在我的应用程序中当前按下按钮后,我有一个按钮的基本动画.按钮完成动画后,我再也无法点击它了.它甚至没有按橙色突出显示.
有帮助吗?
这是我的代码:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
animation = new AnimationSet(true);
animation.setFillAfter(true);
Animation translate = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 5.0f);
translate.setDuration(500);
animation.addAnimation(translate);
LayoutAnimationController controller = new LayoutAnimationController(animation, 0.25f);
generate = (Button)findViewById(R.id.Button01);
generate.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
keyFromTop();
}
});
}
public void keyFromTop(){
generate.setAnimation(animation);
}
Run Code Online (Sandbox Code Playgroud) Eclipse昨晚运行正常,但今天早上我尝试启动它,我发现了这个错误:
替代文字http://img707.imageshack.us/img707/4416/ss20100407181208.png
这是日志
!SESSION 2010-04-07 17:58:37.208 -----------------------------------------------
eclipse.buildId=I20080617-2000
java.version=1.6.0_13
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments: -os win32 -ws win32 -arch x86
!ENTRY org.eclipse.osgi 4 0 2010-04-07 17:58:37.457
!MESSAGE Startup error
!STACK 1
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at org.eclipse.osgi.storagemanager.StorageManager.updateTable(StorageManager.java:512)
at org.eclipse.osgi.storagemanager.StorageManager.open(StorageManager.java:694)
at org.eclipse.osgi.internal.baseadaptor.BaseStorage.initFileManager(BaseStorage.java:208)
at org.eclipse.osgi.internal.baseadaptor.BaseStorage.initialize(BaseStorage.java:142)
at org.eclipse.osgi.baseadaptor.BaseAdaptor.initializeStorage(BaseAdaptor.java:124)
at org.eclipse.osgi.framework.internal.core.Framework.initialize(Framework.java:180)
at org.eclipse.osgi.framework.internal.core.Framework.<init>(Framework.java:152)
at org.eclipse.osgi.framework.internal.core.OSGi.createFramework(OSGi.java:90)
at org.eclipse.osgi.framework.internal.core.OSGi.<init>(OSGi.java:31)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:286)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:175)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at …Run Code Online (Sandbox Code Playgroud) 在Android应用程序中选择文件有一个很好的解决方案吗?我需要用户能够浏览他们的SD卡以获取他们想要加载的文件.但是,它不能使用外部应用程序(如andExplorer或OI文件管理器).它必须保留在我的应用程序中,不要求用户安装其他应用程序.
使用Intent.GET_CONTENT将无法正常工作,因为这些文件属于自定义类型.
谢谢!
我正在编写一个与Android 1.6兼容的应用程序,但我想为运行Android 2.2的用户提供将应用程序安装移动到他们的SD卡的选项.
如何编译1.6的应用程序,但仍允许2.2用户将其安装到他们的SD?
如果它正在加载外部页面(例如,维基百科),是否可以获取IFrame设置的当前URL?我见过一些人说如果它不在你自己的服务器上是不可能的,但我发现那些已经有4年了.
如果不可能,是否有更简单的方法在另一个页面内显示页面并仍然可以访问该URL?
谢谢.
我的问题与这个问题非常相似.我希望能够实例化类型参数类型的对象,但也无需传入"工厂".我真的需要被包含在一个类中.
public class myClass<E> {
E someObject;
public myClass(){
someObject = new E();
}
}
Run Code Online (Sandbox Code Playgroud)
以前的解决方案需要将myClass的构造函数更改为具有工厂参数,然后调用它的构造函数,但出于我的目的,我不想从外部修改对myClass的任何调用.
任何人都可以推荐一个网站,或者向我简要说明如何在NN中实施反向传播?我理解基本概念,但我不确定如何编写代码.
我发现的许多资料只是显示方程而没有给出他们为什么这样做的任何解释,变量名称使得很难找到.
例:
void bpnn_output_error(delta, target, output, nj, err)
double *delta, *target, *output, *err;
int nj;
{
int j;
double o, t, errsum;
errsum = 0.0;
for (j = 1; j <= nj; j++) {
o = output[j];
t = target[j];
delta[j] = o * (1.0 - o) * (t - o);
errsum += ABS(delta[j]);
}
*err = errsum;
}
Run Code Online (Sandbox Code Playgroud)
在那个例子中,有人可以解释的目的
delta[j] = o * (1.0 - o) * (t - o);
Run Code Online (Sandbox Code Playgroud)
谢谢.
在Java中,按照它们出现在列表中的次数对大量单词列表(10,000-20,000)进行排序的最佳/最简单方法是什么?我尝试了一个基本的实现,但是我得到了内存运行时错误,所以我需要一种更有效的方法.你会建议什么?
ArrayList<String> occuringWords = new ArrayList<String>();
ArrayList<Integer> numberOccur = new ArrayList<Integer>();
String temp;
int count;
for(int i = 0; i < finalWords.size(); i++){
temp = finalWords.get(i);
count = 0;
for(int j = 0; j < finalWords.size(); j++){
if(temp.equals(finalWords.get(j))){
count++;
finalWords.remove(j);
j--;
}
}
if(numberOccur.size() == 0){
numberOccur.add(count);
occuringWords.add(temp);
}else{
for(int j = 0; j < numberOccur.size(); j++){
if(count>numberOccur.get(j)){
numberOccur.add(j, count);
occuringWords.add(j, temp);
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
finalWords是所有字符串的列表.我必须存储每个单词出现在单独的arraylist中的次数,因为我想不出更好的方法来保持它们配对而不将每个单词作为单独的对象.
从另一个stackoverflow问题来看,似乎Android处理大型位图的方式与其他内存不同.似乎还有一种方法可以强制Android回收位图以释放内存.任何人都可以启发我如何做到这一点.
我的应用程序一直使用2-6个巨大的位图,因此它在运行时几乎会杀死手机的内存,我想在用户退出时将其清除.
每当我在我的Android应用程序中有一个EditText字段时,一旦活动开始(though the keyboard doesn't pop up),它就会以闪烁的光标突出显示以进行输入.我怎么能禁用它?
我在我的Android应用程序中使用的主要活动使用相当大的内存,这意味着在功能不太强大的手机上,它很容易在不在前面时被杀死.通常这很好,但是当我仍在我的应用程序中时,它也会发生,但在堆栈顶部有不同的活动(例如首选项活动).
显然,如果我的应用程序在用户仍在运行时被杀死,则会出现问题.有没有办法禁用操作系统杀掉低内存问题应用程序的能力?
谢谢.
默认的图库窗口小部件仅提供单击项目时的事件,但有什么方法可以在仅拖动图库时判断选择了哪个项目?