我正在开发一个移动Web应用程序,我有一个主屏幕,上面有许多图标,所以我尝试使用精灵一次性服务所有图像.
然而,我注意到iphone4在我的精灵中很好地缩放了图像(它们看起来有点抖动),但在我的HTC Evo上,精灵渲染的图像看起来非常块状.我切换到标准图像(背景:(/ image_url /)没有背景位置),图像看起来好多了 - 看到这个,左图像是使用单个图像提供的,而右边的图像是从精灵提供的(但是在精灵中是相同的图像).
有没有办法让Android浏览器更好地解释精灵?
首先,我想告诉大家,我已经阅读并成功使用Chris Banes库和Johan Nilsson库开发Pull进行刷新.
现在我想和Johan Nilsson库一起使用GridView.他只为ListView实现,所以我必须修改PullToRefreshListView JAVA文件.
在那里我延伸GridView
而不是ListView
(第24行).然后通过说addHeaderView(mRefreshView)在第109行给出一个错误; 无法识别并将其更改为addView()但addView()
方法也给我运行时错误.
我将使用Johan Nilsson库,因为它让我有机会为我的Activity添加更多的窗体小部件,并轻松自定义设计而不是其他库.
我开发了一个应用程序,应该针对Galaxy Nexus和Galaxy S3.两者都有720 x 1280屏幕分辨率,我只在我的应用程序中使用'dp'值.资源存在于'layout-xhdpi'和'drawable-xhdpi'文件夹中.Nexus上的布局看起来非常精细,但是S3上的填充值(以dp为单位)略有偏差.我认为是因为S3的屏幕尺寸更大,密度不同.
如何为Nexus和S3创建单独的文件夹,以便我可以考虑不同的屏幕尺寸?
我玩了!项目,我想添加一些代码覆盖率信息.到目前为止,我已经尝试过JaCoCo和scct.前者存在基于字节码的问题,因此它似乎对Scala编译器自动生成的方法(例如copy
或)的缺失测试发出警告canEqual
.scct似乎是一个更好的选择,但无论如何我在两个测试期间都会遇到很多错误.
让我坚持使用scct.我基本上每次尝试连接数据库的测试都会出错.我的许多测试都将一些灯具加载到内存中的H2数据库中,然后进行一些断言.我的Global.scala
包含
override def onStart(app: Application) {
SessionFactory.concreteFactory = Some(() => connection)
def connection() = {
Session.create(DB.getConnection()(app), new MySQLInnoDBAdapter)
}
}
Run Code Online (Sandbox Code Playgroud)
而测试通常被封闭在一个块中
class MySpec extends Specification {
def app = FakeApplication(additionalConfiguration = inMemoryDatabase())
"The models" should {
"be five" in running(app) {
Fixtures.load()
MyModels.all.size should be_==(5)
}
}
}
Run Code Online (Sandbox Code Playgroud)
该行running(app)
允许我在连接到内存数据库的工作应用程序的上下文中运行测试,至少通常是这样.但是当我运行代码覆盖任务(例如scct)时coverage:doc
,我会收到很多与连接数据库相关的错误.
更奇怪的是,至少有4种不同的错误,例如:
为什么在默认配置中启动测试能够连接到数据库,而在scct(或JaCoCo)的上下文中运行无法初始化缓存和数据库?
给出像这样的json字符串:
[{"id":28,"Title":"Sweden"},{"id":56,"Title":"USA"},{"id":89,"Title":"England"}]
Run Code Online (Sandbox Code Playgroud)
我需要检查一个对象是否存在,检查所有字段,意思是:
{"id":28,"Title":"Sweden"} => exists
{"id":29,"Title":"Sweden"} => doesn't exist
Run Code Online (Sandbox Code Playgroud)
要么
{"id":28,"Title":"Sweden"} => exists
{"id":28,"Title":"Sweden2"} => doesn't exist
Run Code Online (Sandbox Code Playgroud)
集合可以包含任意数量的对象,对象将始终具有相同数量的属性(id,title)或(id,title,firstName)等.
另外,为了检查现有对象,是否需要将字符串解析为json对象集合?
我试过这个:
$.map(val, function (obj) {
if (obj === val)
alert('in');
return obj; // or return obj.name, whatever.
});
Run Code Online (Sandbox Code Playgroud) 我刚刚将Android SDK更新到最新版本以及我的ADT,之后我无法创建新的AVD.
这是它给我的错误:
[2013-03-07 19:55:07 - SDK Manager] Error parsing C:\Users\sr\.android\devices.xml, backing up to C:\Users\sr\.android\devices.xml.old
[2013-03-07 19:55:15 - SDK Manager] Error parsing C:\Users\sr\.android\devices.xml, backing up to C:\Users\sr\.android\devices.xml.old
Run Code Online (Sandbox Code Playgroud)
我重新安装了我的eclipse,Android SDK和ADT,但仍然遇到此错误.我在Windows 7上运行它.如何解决此问题,以便创建新的AVD?
我正在做那种下拉到刷新的事情.在scrollViewDidEndDecelerating中,我检查偏移是否超过某个点,并在scrollViewDidEndDragging中设置contentInset,以便保持下拉部分可见.
但是,这会导致闪烁,可能是由于在滚动动画期间重置了contentInset.我想我可以通过在scrollViewWillEndDragging中设置targetContentOffset来阻止这种情况,但它似乎没有做到这一点.
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
if (scrollView.contentOffset.y < -kRefreshViewDelta)
{
self.tableView.contentInset = UIEdgeInsetsMake(kRefreshViewHeight, 0.0f, 0.0f, 0.0f);
}
}
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
{
if (scrollView.contentOffset.y < -kRefreshViewDelta)
{
targetContentOffset->y = kRefreshViewHeight ;
}
}
Run Code Online (Sandbox Code Playgroud) 我在我的应用程序中使用选项菜单.但是当我在Galaxy Nexus上安装应用程序时,我没有看到选项菜单,因为默认情况下它没有选项菜单按钮.如何在我的应用程序中仅为Galaxy Nexus显示选项菜单按钮?使用其他手机很好,我可以选择菜单.
我有一个libgdx程序,它从以下类开始:
public class MyActivity extends AndroidApplication implements IActivityRequestHandler
Run Code Online (Sandbox Code Playgroud)
我需要有一个Activity
类来检测屏幕大小Display
(我不能在AndroidApplication
课堂上这样做).
所以我添加了以下类作为我的启动器Activity
:
public class MyActivity1 extends Activity
Run Code Online (Sandbox Code Playgroud)
所以在我的新课程中,MyActivity1
我尝试运行我的旧课程MyActivity
:
Intent myIntent = new Intent(MyActivity.this, MyActivity.class);
startActivity(myIntent);
Run Code Online (Sandbox Code Playgroud)
但是我得到了以下编译错误:MyActivity不是封闭类
清单如下
<activity android:name=".MyActivity1"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".MyActivity"/>
Run Code Online (Sandbox Code Playgroud)
为什么我收到此错误?
所以我在Android开发者网站上关于Fragments的第三个教程已经停留了几天.当我在平板电脑上运行应用程序(大屏幕布局)时,我无法理解应用程序如何填充数据.我可以理解如何在较小的屏幕(手机屏幕)上填充数据.
更大的屏幕列表如何填充数据?
这是Android.com教程中整个项目的链接.
MainActivity类
public class MainActivity extends FragmentActivity
implements HeadlinesFragment.OnHeadlineSelectedListener {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Here, the system will decide which news_article layout it will use based on the screen size. Will use layout if small or layout-large if it's big.
setContentView(R.layout.news_articles);
// Check whether the activity is using the layout version with
// the fragment_container FrameLayout. If so, we must add the …
Run Code Online (Sandbox Code Playgroud) android ×7
galaxy-nexus ×2
adt ×1
css-sprites ×1
fragment ×1
galaxy ×1
gridview ×1
ios ×1
javascript ×1
jquery ×1
layout ×1
sbt ×1
scala ×1
scct ×1
sdk ×1
uikit ×1
uitableview ×1