我将图像添加到SDCARD上的文件夹中.由于图像和我的文件夹在图库中没有立即可见,我试图让MediaScannerConnection更新并在图库中显示文件夹/图像.这对我来说不是很好,因为Gallery中没有任何内容.我只在Eclipse AVD中测试.
我没有看到很多关于这个的讨论,因为scanFile是自api8以来的新功能.有人能说明这是怎么做的吗?
我在服务和Activity中尝试它但在onScanCompleted时继续获得uri = null.
如果我有一个填充屏幕的ImageView.
ImageView背景设置为绿色.
我在ImageView中放置一个位图,保持位图比例.
此布局中的纵向照片将在左侧和右侧显示绿色
(手机方向=纵向).
现在,当绿色结束和位图开始时,如何获得边缘的左侧x/y位置.
这个努力项目的背景是我想在图像上写文字并将图像保存回带有文本的新图像.问题是..
因为我缩放图像inSampleSize = 4; 并且ImageView将其收缩得更多,保存这张新照片将会产生一个小的约250x350的小图像.
我想要的是使用x/y位置并将书面文本传输到原始的inSampleSize = 4图像或sdcard 1500x3000图像
我知道并阅读有关此问题的其他问题,我必须自己"做数学计算"我只需要这个小答案.
我忘了我可以截取屏幕截图.
这就是它的样子:(按下按钮"笔"时我会得到一支新笔,每支笔在屏幕上保持自己独特的文字和位置

这是imageview
import java.util.HashMap;
import java.util.UUID;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Environment;
import android.util.AttributeSet;
import android.view.Display;
import android.view.MotionEvent;
import android.widget.EditText;
import android.widget.ImageView;
public class DrawView2 extends ImageView {
private HashMap<String, ColorBall2> HashBall ;
private String balID = ""; // variable to know what …Run Code Online (Sandbox Code Playgroud) 我一直在努力让这个工作,我认为我可以使用 RelativeLayout
android:layout_weight="0.3"
Run Code Online (Sandbox Code Playgroud)
在屏幕右侧放置三个按钮,不是居中,而是从顶部向下30%.
这是可能的,如果是这样,我该怎么做?
以下是我的XML,它显示了三个按钮在彼此之下,但在右上角位置:
</RelativeLayout>
<LinearLayout
android:id="@+id/rightRelativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:orientation="vertical"
>
<ImageButton
android:id="@+id/btn_A"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="A"
android:src="@drawable/drawer_1"
android:background="@android:color/transparent"
/>
<ImageButton
android:id="@+id/btn_B"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:text="B"
android:src="@drawable/drawer_1"
android:background="@android:color/transparent"
android:layout_below="@+id/btn_A"
/>
<ImageButton
android:id="@+id/btn_C"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="10dp"
android:text="C"
android:src="@drawable/drawer_1"
android:background="@android:color/transparent"
android:layout_below="@+id/btn_B"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
[更新]为需要它的人添加了最终工作版本
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/examplegallery"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<RelativeLayout
android:id="@+id/InnerRelativeLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<Button
android:id="@+id/btn_newpen_drawtext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pen"
/>
<EditText
android:id="@+id/etx_addtext_drawtext"
android:layout_width="fill_parent"
android:layout_toLeftOf="@+id/btn_delete_pen"
android:layout_toRightOf="@+id/btn_newpen_drawtext" …Run Code Online (Sandbox Code Playgroud) 如图所示,文字不在墙上.这是一个奇怪的行为,我认为这是一个错误
这是一个屏幕截图:
这是标题xml:
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/windowBackground"
android:orientation="vertical">
<TextView
android:id="@+id/street_name"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginStart="15dp"
android:text="street name"
android:textColor="?AppTheme.InformationText"
android:textSize="14sp"
android:textStyle="bold"
android:gravity="center"
android:layout_marginTop="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="19dp"
android:layout_marginLeft="0dp"
app:layout_constraintWidth_default="wrap"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/guideline29"
app:layout_constraintTop_toTopOf="@+id/guideline37"
app:layout_constraintRight_toLeftOf="@+id/guideline30"
app:layout_constraintHorizontal_bias="0.605"
app:layout_constraintVertical_bias="0.0"/>
<ImageView
android:id="@+id/street_view_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:padding="6dp"
android:scaleType="fitCenter"
tools:layout_constraintLeft_creator="1"
android:layout_marginLeft="0dp"
app:layout_constraintLeft_toLeftOf="@+id/country_flag_image"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="0dp"
app:layout_constraintRight_toLeftOf="@+id/guideline29"
android:layout_marginRight="8dp"
app:layout_constraintTop_toTopOf="@+id/guideline37"
android:layout_marginTop="8dp"/>
<ImageView
android:id="@+id/country_flag_image"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginLeft="4dp"
android:layout_marginStart="4dp"
android:layout_marginTop="8dp"
android:adjustViewBounds="true"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintTop_creator="1"
/>
<de.hdodenhof.circleimageview.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/exit_image"
android:layout_width="46dp"
android:layout_height="46dp"
android:layout_marginBottom="8dp"
android:layout_marginRight="-4dp"
android:src="@drawable/exit_custom"
app:border_color="#FF000000"
app:layout_constraintBottom_toBottomOf="@+id/street_view_image"
app:layout_constraintRight_toRightOf="@+id/street_view_image"
tools:layout_constraintBottom_creator="1"
tools:layout_constraintRight_creator="1"
/>
<android.support.constraint.Guideline
android:layout_width="wrap_content" …Run Code Online (Sandbox Code Playgroud) 更具体的我在哪里附加,OnGestureListener以便
我可以onSingleTapUp在屏幕上的任何地方检测到,
即使ImageView占据屏幕的一半.
现在我在Activity上有一个带有ImageView的Listener.
但是当我在ImageView外部单击时,Listener才会触发.
我阅读并尝试理解这一点,但无法做到正确.
此代码位于Activity中.
public boolean onSingleTapUp(MotionEvent e) {
//addtext.setText("-" + "SINGLE TAP UP" + "-");
//Log.d(TAG, "- + SINGLE TAP UP + - ***********************************************************************");
int btnsize = buttonSave.getHeight();
int viewWidth = display.getWidth();
int viewHeight = display.getHeight();
// RIGHT SIDE SCREEN
if(e.getX()> (viewWidth*0.7)){
Log.d(TAG, "RIGHT SIDE");
if(e.getY()> viewHeight*0.7){
Log.d(TAG, "right down on screen");
}else if(e.getY()> (viewHeight*0.45)){
Log.d(TAG, "right middle on screen ");
}
}
// LEFT SIDE SCREEN
if(e.getX()< (viewWidth*0.3)){
Log.d(TAG, …Run Code Online (Sandbox Code Playgroud) 我是MongoDb和Morphia的新手,并
试图学习如何更新我的文档.
我无法从这个页面看到/理解如何做到这一点:http:
//www.mongodb.org
我的文档如下所示:(可能在这里有些错误)
@Entity
public class UserData {
private Date creationDate;
private Date lastUpdateDate;
@Id private ObjectId id;
public String status= "";
public String uUid= "";
public UserData() {
super();
this.statistic = new Statistic();
this.friendList = new FriendList();
}
@Embedded
private Statistic statistic;
@Embedded
private FriendList friendList;
@PrePersist
public void prePersist() {
this.creationDate = (creationDate == null) ? new Date() : creationDate;
this.lastUpdateDate = (lastUpdateDate == null) ? creationDate : new Date();
}
}
Run Code Online (Sandbox Code Playgroud)
在那个页面上,我看不到任何地方,他们描述如何更新我的UserData …
我有以下代码:
float fl = ((float)20701682/(float)20991474);
Run Code Online (Sandbox Code Playgroud)
这给了我fl = 0.9861948.
我想转换0.9861948到2%,因为2%已经被下载.
我正在下载文件并计算进度.
任何帮助都会受到影响.
在使用Proguard并使用新密钥签名和导出后,我的应用程序崩溃了.
相同的代码在普通的eclipse调试模式下工作.
我到处读到我应该使用mapping.txt找到失败的代码.但是如何做到这一点,我现在谷歌这2小时,没有答案是有效的.
我现在用debug.keystore签署apk文件并使用默认密码"android".
有人说我应该在我的应用程序标签中安装android:debuggable ="false",以使Proguard在eclipse中混淆我的调试会话.
这是正确的吗?
任何帮助都会受到影响
在Proguard Android Developer页面上,我无法找到这样做的方法
"当您的混淆代码输出堆栈跟踪时,方法名称会被混淆,这使得调试变得很困难"
什么"堆栈跟踪"和从哪里?
在页面Proguard手册我找不到解释
使用Eclipse创建了一个测试应用程序,以便authToken从我的设备上获取我的一个谷歌电子邮件帐户.
执行此操作提示我使用允许访问对话框,我按下允许访问:
accountManager.getAuthToken(account,"oauth2:https://www.googleapis.com/auth/userinfo.profile", false, new GetAuthTokenCallback(), null);
Run Code Online (Sandbox Code Playgroud)
我想创建一个从API8开始的选择器对话框,用户可以在其中选择允许我访问的Google帐户.为此,我必须撤消再次查看屏幕的权限.
我应该在这个页面上看到我的测试应用程序吗?
授权访问您的Google帐户
我已经搜索了一种撤销权限的方法,而非正在运行..
只有工作才能创建一个新的应用项目.
更新2013
使用Google Play服务GCM,这项工作正常
使用访问令牌OAuth 2.0进行处理时简而言之,使用以下内容有何不同:
AccountManager.getAuthToken ("oauth2:https...userinfo.profile"),
并使用Google Play:
GoogleAuthUtil.getToken(mActivity, mEmail, mScope)
Run Code Online (Sandbox Code Playgroud)
根据我的理解,它们都为用户生成了挑战屏幕,Google Plays屏幕对用户更友好.访问令牌可以具有相同的范围吗?!两个调用都必须是异步的.InvalidateToken似乎必须在两个调用中检查,还有更多?
