有人可以用我的语法帮助我吗?我正在动态地将一些视图(自定义视图)添加到已经在XML中定义的FrameLayout.那些自定义视图是不同类型或相同类型.我可以在屏幕上添加视图,但无法从ViewGroup中删除特定视图(类型相同或不同).那些自定义视图onTouch().
在这里,我面临着问题:无法触发long click,总是需要touch listener
如果用户在长按时选择一个视图,我必须在这里创建两个选项
编辑:根据tao建议我可以得到长按视图的索引,如果没有触摸监听器的查看.但我必须实施触控听众以及长按......
我怎样才能做到这一点?
在阅读了有关如何创建P2P网络功能的更多内容之后,我想开始peer-to-peer创建自己的套接字.
我正在研究Android平台的一些应用程序,我有问题,我不太确定如何处理,两者密切相关.
是否有可能temporary p2p live data stream从一个Android设备创建到另一个?
我想将视频,音频和图像文件从手机A传递到手机B.
我非常感谢在任何一个问题(文件传输或实时数据传输)上指向正确的方向,如果可能的话,给我任何示例应用程序.
我需要在本机代码(c语言代码)和Android代码之间创建回调.我编写了JNI函数,用于C code从这样的android 调用
JNI代码在这里
#include <android/log.h>
void initSocket();
#ifdef __cplusplus
extern "C" {
#endif
JNIEXPORT void JNICALL Java_org_pjsip_pjsua_pjsua_1appJNI_initSocket(JNIEnv *jenv, jclass jcls) {
__android_log_write(ANDROID_LOG_INFO, " JNI CODE ", " APP INIT SOCKET");
initSocket();
}
}
Run Code Online (Sandbox Code Playgroud)
C代码看起来像这样
void initSocket()
{
/// some more stuff
printf(" initSocket function ");
}
static int worker_thread(void *unused)
{
/// some more stuff
return 0;
}
pj_bool_t on_rx_data1(pj_stun_sock *stun_sock, void *pkt, unsigned pkt_len, const pj_sockaddr_t *src_addr, unsigned addr_len)
{
/// some more stuff
return PJ_TRUE; …Run Code Online (Sandbox Code Playgroud) 我尝试更改中的homeAsUpIndicator图标ActionBar.我ActionBarSherlock用来兼容较旧的Android版本.当App在具有ICS和ICS的较旧版本的设备上运行时,我为我的Activity设置了一个特定的主题,它显示了不同的颜色.
这是我正在使用的风格
<style name="Theme.PM" parent="@style/Theme.Sherlock.Light">
<item name="android:homeAsUpIndicator">@drawable/back_sign</item>
<item name="homeAsUpIndicator">@drawable/back_sign</item>
</style>
Run Code Online (Sandbox Code Playgroud)
像下面的图像对于ICS看到家庭作为向上指示器看起来像黑色.

对于较早版本的ICS,请将该家作为向上指示器看起来像白色.

我在两个版本中使用相同的图像,但它在ICS上看起来有所不同.如何解决这个问题呢..
我需要旋转一个布局(有一个TextView和ImageView),它应该在RelativeLayout中右对齐和顶部对齐.我创建了我的布局,这个布局放在右上角.但如果我旋转它我不能正确对齐.我该怎么办?
我的相对布局
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:background="@drawable/background"
android:layout_height="wrap_content"
android:id="@+id/testRL">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:id="@+id/testRotateLL">
<ImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/picture_border_offer_first_page" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="7000TL"
android:textSize="15sp"
android:layout_centerInParent="true"
android:textColor="@android:color/white"
android:id="@+id/amountLayoutTV" />
</RelativeLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
然后我用动画旋转这个linearLayout.旋转好,..
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="45"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:detachWallpaper="true"
android:duration="0"
android:fillAfter="true">
</rotate>
Run Code Online (Sandbox Code Playgroud)
旋转新视觉后...

我正在Android中创建一个应用程序,我想通过蓝牙将我的特定应用.apk文件传输到另一个Android手机.我正在设置一个名为"共享应用程序"的选项菜单,点击它会将我的应用程序.apk文件传输到蓝牙开启的手机.它在J2ME中创建相同的应用程序时工作得非常好,现在我在Android中尝试它并且它无法正常工作.这样做有什么办法吗?任何回复都会对我有所帮助.
我正在使用相机拍照并希望存储在数据库中(SQLite).存储的照片必须显示在另一个活动中,列表视图就像这个列表视图图像 和这个 iam使用此代码拍照但如何将照片存储在数据库中并显示在另一个活动任何想法请帮助.....
谢谢....
这是拍照的代码
public class PhotoActivity extends Activity {
private static final int CAMERA_REQUEST = 1888;
public ImageView imageView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.photoactivity);
this.imageView = (ImageView)this.findViewById(R.id.imageView1);
Button B = (Button) this.findViewById(R.id.camera);
B.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
}
});
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST) {
Bitmap photo = (Bitmap) data.getExtras().get("data");
imageView.setImageBitmap(photo);
}
}
}
Run Code Online (Sandbox Code Playgroud) 我有关于处理问题touch events的CustomView.I'm添加自定义视图的动态布局(即FrameLayout里).那些具有touchListeners的自定义视图用于在角落处拉点(如下图所示).除此之外我必须在屏幕上拖放整个视图,如果用户触摸除了那些角点之外(图像中的颜色区域)必须拖放视图,否则不会,以及如果用户触摸到外面查看我不想触发任何触摸侦听器.

我可以使用此代码来提取这些点
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
if (topTouchArea.contains(event.getX(), event.getY())) {
currentTouch = TOUCH_TOP;
} else if (RightTouchArea.contains(event.getX(),event.getY())) {
currentTouch = TOUCH_RIGHT;
} else if (LeftTouchArea.contains(event.getX(),event.getY())) {
currentTouch = TOUCH_LEFT;
} else {
return false; //Return false if user touches none of the corners
}
return true;
case MotionEvent.ACTION_MOVE:
switch (currentTouch) {
case TOUCH_TOP:
top.x = event.getX();
top.y = event.getY();
invalidate();
return true;
case TOUCH_RIGHT:
Right.x = event.getX();
Right.y …Run Code Online (Sandbox Code Playgroud) 我在我的应用程序中开发了电子邮件发送功能,我需要发送包含指定主题的电子邮件.我已经做到了,但是一旦我点击电子邮件图标我就需要它.它在电子邮件格式的正文部分设置了一些特定的信息.它可能是我与我的任何信息.
是否可以在android中的Email Body中设置数据,我不想在邮件正文中写任何内容.
谢谢,DavidBrown
我在我的应用程序中使用flurry sdk,在添加这个flurry jar文件之前它没有任何错误.在libs文件夹中添加flurry jar文件后,当我在Eclipse中编译应用程序时,我收到此错误.
trouble writing output: Too many methods: 70205; max is 65536. By package:
5 android.accessibilityservice
1 android.animation
2 android.annotation
315 android.app
136 android.content
28 android.content.pm
47 android.content.res
35 android.database
14 android.database.sqlite
8 android.gesture
113 android.graphics
44 android.graphics.drawable
1 android.graphics.drawable.shapes
11 android.location
27 android.media
40 android.net
1 android.net.http
1 android.net.wifi
96 android.os
[2013-03-04 16:42:13 - myapp] Conversion to Dalvik format failed with error 2
Run Code Online (Sandbox Code Playgroud)
我知道如何解决,error 1但这是我无法解决的新错误.我搜索了很多没有得到任何解决方案.
当我删除这个jar文件它工作正常.如果它在libs中无法运行应用程序.为什么我收到此错误.?什么是溶剂...
android ×10
custom-view ×2
android-ndk ×1
camera ×1
database ×1
indexing ×1
listview ×1
native-code ×1
p2p ×1
view ×1
viewgroup ×1