我需要从第三方JAR中删除未使用的类.为什么我应该使用工具?
我已经尝试过使用ProGuard.但是,它只从项目本身中删除未使用的类,但库罐 - 第三方 - 始终保持不变.
我有一个阿拉伯语Android应用程序,这里是XML代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/greygradientbackground">
<ImageView android:id="@+id/logo"
android:layout_width="150dp"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:layout_margin="5dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true" />
<TextView android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textColor="#000000"
android:layout_gravity="center_vertical|right"
android:gravity="right"
android:layout_toLeftOf="@id/logo"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
问题是android:gravity适用于某些Android机型而其他机型则不适用.
更具体地说,我已经在许多2.3.3安卓设备上测试了应用程序,并且阿拉伯语文本对齐了.但是在其他2.3.3设备上,阿拉伯语文本左对齐(这是错误的).
当我改变android:gravity ="right"到android:gravity ="left"时,问题从第二组设备转移到第一组.
所以我的问题是如何解决这个问题,特别是据我所知,没有办法根据设备型号来本地化布局.
提前感谢任何指导,因为我完全迷失了.:(
更新:
我搜索了"如何在所有Android版本上正确对齐阿拉伯语?" 但发现我的所有测试设备都没有工作.有什么建议吗?我确信有一种最佳实践方法可以在Android上对齐阿拉伯语文本.
更新2:
我尝试使用WebView而不是TextView使用CSS样式正确对齐阿拉伯语.但是,阿拉伯语文本在WebView中显示为奇怪的字符.
这是代码:
mWebView.loadData("<html dir=\"rtl\">?????<body></body></html>", "text/html", "UTF-8");
Run Code Online (Sandbox Code Playgroud)
奇怪的是,阿拉伯语网站文本显示正确.所以有什么问题?:(
我想知道 - 一个例子非常感谢 -
如何在Google App Engine for Java中建立关系模型?
-
一对多- 多到多
我在网上搜索过,我发现没有关于Java的所有指南和教程都是关于Python的.
我从这篇文章中了解到,在Python中,关系是使用ReferenceProperty建模的.但是,我在Javadoc引用中没有发现这个类.
此外,在本文中他们讨论了以下内容:
目前,Java用户的工具短缺,主要是由于App Engine的Java平台相对较新.
但是,那是在2009年写的.
最后,我最终使用每个实体的祖先路径建模关系.我发现这个方法存在问题并限制了应用程序的可伸缩性.
你能指导我到Python的ReferenceProperty类的等效Java 类吗?或者,您能否举例说明如何使用Java数据存储区低级API在AppEngine中建模关系.
在此先感谢您的帮助.
java google-app-engine referenceproperty google-cloud-datastore
我想开发一个Dialog,它由3个步骤组成,以指导用户第一次启动应用程序时.
下图是我想要实现的一个例子:

1-我想知道如何添加标记以关闭右上角的对话框?
2-如何在屏幕底部实现指示当前步骤的小圆圈?它们可以通过编程方式创建吗?
3 - 只是为了确定,我决定使用ViewFlipper在Dialog步骤之间导航.这是正确的方法吗?
提前致谢.
当用户更改语言区域设置时,我想使用新的区域设置重新加载活动。我想在完成活动并再次启动时创建一个动画过渡。
过渡动画如下:
退出动画是将活动缩放到屏幕中心。进入动画是从屏幕中心缩放活动。
finish();
overridePendingTransition(0, R.anim.scale_to_center);
Intent intent =new Intent(SettingsActivity.this, SettingsActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.scale_from_center, 0);
Run Code Online (Sandbox Code Playgroud)
我的scale_to_center.xml是:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale android:fromYScale="1.0" android:toYScale="0"
android:fromXScale="1.0" android:toXScale="0"
android:pivotX="50%" android:pivotY="50%"
android:duration="500"/>
</set>
Run Code Online (Sandbox Code Playgroud)
我的scale_from_center.xml是:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale android:fromYScale="0" android:toYScale="1.0"
android:fromXScale="0" android:toXScale="1.0"
android:pivotX="50%" android:pivotY="50%"
android:startOffset="500"
android:duration="2000"/>
</set>
Run Code Online (Sandbox Code Playgroud)
问题是只出现进入转换而没有出现退出转换。我试图为退出转换添加延迟,但它也不起作用。
但是,当我将代码更改为仅对应用程序退出进行动画处理时。有效。
finish();
overridePendingTransition(0, R.anim.scale_to_center);
Run Code Online (Sandbox Code Playgroud)
谢谢。
java android android-animation android-layout android-activity