小编JDx*_*JDx的帖子

静态类的非法修饰符错误

我正在开发一个Android应用程序,但已经打了一个砖墙,我不断收到错误:

Illegal modifier for the class FavsPopupFragment; only public, abstract & final are permitted
Run Code Online (Sandbox Code Playgroud)

这是在对另一个SO问题的回答之后发生的.这是我的代码:

package com.package.name;

/* Imports were here */

public static class FavsPopupFragment extends SherlockDialogFragment {

    static FavsPopupFragment newInstance() {
        FavsPopupFragment frag = new FavsPopupFragment();
        return frag;
    }
}
Run Code Online (Sandbox Code Playgroud)

该错误出现在类名称上.我不明白为什么这不起作用,请帮忙.谢谢.

java static android

26
推荐指数
2
解决办法
6万
查看次数

Android:动画被父视图剪裁

我目前有一个ImageView,我正在应用缩放动画.此视图位于相对布局中,其layout_height和layout_width设置为wrap_content.问题是当动画开始时它会使imageview比其父布局更大,然后图像被切断.有没有办法解决?

这是一个工作样本:

xml文件 -

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dip" 
    android:layout_gravity="center_horizontal">
    <ImageView
        android:id="@+id/imgO"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/circle"/>
    </RelativeLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

java文件 -

ImageView imgO;

ScaleAnimation makeSmaller;
ScaleAnimation makeBigger;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.titlescreen);

    //Animation
    imgO = (ImageView)findViewById(R.id.imgO);

    makeSmaller = new ScaleAnimation((float)10.0, (float)1.0, (float)10.0, (float)1.0, Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.5);
    makeSmaller.setAnimationListener(new MyAnimationListener());
    makeSmaller.setFillAfter(true);
    makeSmaller.setDuration(500);
    makeBigger = new ScaleAnimation((float)1.0, (float)10.0, (float)1.0, (float)10.0, Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.5);
    makeBigger.setAnimationListener(new MyAnimationListener());
    makeBigger.setFillAfter(true);
    makeBigger.setDuration(750);
    imgO.startAnimation(makeBigger);
}

class MyAnimationListener implements AnimationListener …
Run Code Online (Sandbox Code Playgroud)

layout animation android

24
推荐指数
2
解决办法
1万
查看次数

在Xcode中查找未使用的文件

我最近开始研究一个新的应用程序,它基本上是我之前的应用程序的副本,只有一些变化.为了制作这个新应用程序,我复制了旧应用程序并删除了一些不需要的东西.

我想知道,有没有办法告诉Xcode中正在使用哪些类文件?或者有关如何查找未使用文件的任何提示?

xcode ios

16
推荐指数
2
解决办法
2万
查看次数

Android:无法在aidl文件中找到类java.util.ArrayList的导入

我目前有一个远程服务,它获取用户当前位置(这一切都正常).我现在希望能够获取用户当前位置,然后将其添加到以前位置的列表中.这是我的aidl文件,我遇到了问题:

import android.location.Location;
import java.util.ArrayList; //error line: couldn't find import for class java.util.ArrayList

interface ILocationService {
    Location getCurrentLocation();
    ArrayList<Location> getAllLocations();
}
Run Code Online (Sandbox Code Playgroud)

任何帮助将非常感激.谢谢.

service android location

5
推荐指数
1
解决办法
6227
查看次数

这个日期字符串的格式是什么?

我试图将一堆NSStrings转换为NSDate对象.这是一个示例字符串:

2013-04-25T15:51:30.427+1.00
Run Code Online (Sandbox Code Playgroud)

但我无法弄清楚它到底是什么格式,到目前为止我(问号是我难倒的位):

yyyy-MM-ddTHH:mm:ss????zzz
Run Code Online (Sandbox Code Playgroud)

我遇到的主要问题是".427"部分,但如果我在其他地方犯了错误,请告诉我:)

有没有人有任何想法?或者可以指出我所有可能的日期格式说明符的列表?我发现了这个:http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx这是有用的,但它似乎没有任何'.427'部分的说明符,我坚持.

任何帮助表示赞赏,谢谢.

iso8601 date-format nsdateformatter date-formatting ios

5
推荐指数
1
解决办法
2775
查看次数

在 Xcode 数据模型编辑器中的配置之间移动实体

我目前正在开发一个应用程序,希望它能够使用 Core Data 来存储/检索 2 个 sqlite 文件中的数据(目前它只使用 1 个)。我意识到要做到这一点,我必须在Xcode 的核心数据模型编辑器中创建另一个配置,我已经完成了。现在,我正在尝试将实体从当前配置移动到新配置中,但我找不到一种方法。我使用的是 Xcode 版本 4.5.1。

我这样做对吗?如何在配置之间移动实体?

任何帮助深表感谢 :)

xcode ios xcdatamodel

3
推荐指数
1
解决办法
2111
查看次数