我必须在画布上绘制 2 个字符串。字符串必须使用相同的坐标绘制,第二个字符串必须是围绕 Y 轴旋转第一个字符串 45 度的结果。结果必须如下所示:

这是我的代码:
Matrix matrix = new Matrix();
matrix = canvas.getMatrix();
mCamera = new Camera();
canvas.drawText("In the name of God", 30, 100, redPaint);
mCamera.rotateY(45);
mCamera.getMatrix(matrix);
matrix.preTranslate(30, 100);
// matrix.postTranslate(-30, -100);
canvas.setMatrix(matrix);
canvas.drawText("In the name of God", 0, 0, greenPaint);
Run Code Online (Sandbox Code Playgroud)
但是上面代码的结果是:

你可以看到字符串的坐标是不同的。那么我做错了什么?我猜是由matrix.preTranslate().
更新:
我改变我的代码,如:
canvas.drawText("In the name of God", 30, 100, redPaint);
mCamera.rotateY(45);
mCamera.getMatrix(matrix);
matrix.preTranslate(-30, -100);
matrix.postTranslate(30, 100);
canvas.setMatrix(matrix);
canvas.drawText("In the name of God", 0, 0, greenPaint);
Run Code Online (Sandbox Code Playgroud)
或喜欢:
canvas.drawText("In …Run Code Online (Sandbox Code Playgroud) 我用Android Studio 3.2。清理/重建项目时,我在build工具窗口中看到以下警告:
W/ResourceType( 6139): For resource 0x0101053d, entry index(1341) is beyond type entryCount(1155)
W/ResourceType( 6139): For resource 0x0101053e, entry index(1342) is beyond type entryCount(1155)
W/ResourceType( 6139): For resource 0x0101053b, entry index(1339) is beyond type entryCount(1155)
W/ResourceType( 6139): For resource 0x0101053c, entry index(1340) is beyond type entryCount(1155)
Run Code Online (Sandbox Code Playgroud)
如您所见,没有任何要检出文件的地址。我也尝试谷歌,看到这个和这个问题,但我无法找到可以帮助我的任何事情。我该如何解决这个问题?
代码
SngList.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView a, View v, int position, long id) {
Intent intent = new Intent(getActivity(), NowPlaying.class);
intent.putExtra("Data1",Songinfo);
intent.putExtra("Data2",position);
startActivity(intent);
}
});
Run Code Online (Sandbox Code Playgroud)
接收类中的代码
Intent i = getIntent();
ArrayList<SongDetails> Songinfo2 = (ArrayList<SongDetails>)i.getSerializableExtra("Data1");
position=i.getIntExtra("Data2", 1);
Run Code Online (Sandbox Code Playgroud)
songDetials的代码
package sourcecode.jazzplayer;
import java.io.Serializable;
import android.graphics.Bitmap;
public class SongDetails implements Serializable{
Bitmap icon ;
String song;
String Artist;
String Album;
String Path;
int icLauncher;
public String getSong() {
return song;
}
public void setSong(String song) {
this.song = song;
}
public String …Run Code Online (Sandbox Code Playgroud) 我希望我的服务可以作为Share page用户长时间触摸web-link(标准android功能)时的默认选项之一进行访问.这是我在清单文件中写的:
<service android:name=".ShareLink"
android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</service>
Run Code Online (Sandbox Code Playgroud)
但它仍未显示.我究竟做错了什么?PS当我对Activity做同样的事情时 - 它工作正常.
有没有办法强迫AppWidget工作,甚至App被移动到SD卡而SD卡不是unmounted?文件说:
...如果您的应用程序使用以下任何功能,则不应允许将其安装在外部存储上,因为在卸载外部存储时会引起后果:
...
应用程序小部件
您的应用程序小部件将从主屏幕.重新装入外部存储时,在系统重置主应用程序之前,用户无法选择您的应用程序小组件(通常直到系统重新启动).
似乎文档说AppWidget将从主屏幕if用户卸下SD卡.但是当我将模拟器中的App移动到SD卡(我没有卸载SD卡)时,problem loading widget在主屏幕中看到消息,小部件也不可用对于小部件列表中的用户.为什么?
在UML中,同时使用合并节点和merge nodeand是否合法decision node?看起来像这样:

我认为这可能有助于避免复杂的图表。如果那不可能,为什么它是非法的?
这是一个描述我的问题的简化类:
public class Main {
enum Test{
First(method()){ // Unhandled exception type Exception
// ...
};
Test(Object obj){
//...
}
}
static Object method() throws Exception{
// ...
if (someCondition){
throw new Exception();
}
}
}
Run Code Online (Sandbox Code Playgroud)
以上someCondition依赖于设备和某些情况下,我不能在这件事现在决定,也正如你所看到的,我不想抓Exception的method。
我一直在关注来自O'reilly媒体的视频教程,介绍了android的基础知识.该应用程序是一个flashlight,它只应该使用一个按钮在两个活动之间切换.但是,当我打电话startActivity(intent)时RedFlashlightActivity.java,应用程序强制关闭,意图只会改变活动.Eclipse也没有发现任何错误.
谢谢你的帮助!
我把代码放在pastebin中,因为我认为它会阻塞帖子.
RedFlashlightActivity.java http://pastebin.com/4ejjgaXp
GreenFlashlightActivity.java http://pastebin.com/SdGV32kL
这段代码有错误
public class DoIt {
public static void main(String[] args) {
final class Apple {
public static String place = "doIt";
}
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
System.out.println(Constants.place);
}
});
thread.start();
}
}
Run Code Online (Sandbox Code Playgroud)
错误- The field name cannot be declared static in a non-static inner type, unless initialized with a constant expression
我有两个项目,我想将它们组合在一起.当我在设备上单独安装它们时,启用" 打开 "按钮(在成功安装后已经表示的页面中).但是当我将它们组合时,"打开"按钮将被禁用,虽然安装过程将成功完成.我猜这个错误是因为清单文件,但我不确定.谢谢你的时间.

android ×7
java ×3
camera ×1
enums ×1
exception ×1
matrix ×1
nested-class ×1
serializable ×1
static ×1
uml ×1