小编Cyp*_*eld的帖子

在Objective-C中,如何测试对象类型?

我需要测试对象是类型NSString还是UIImageView.我怎么能做到这一点?是否有某种类型的"isoftype"方法?

objective-c ios

548
推荐指数
6
解决办法
24万
查看次数

使元素固定在滚动上

我试图让导航栏粘到顶部,当用户向下滚动到导航栏然后在用户向上滚动通过导航栏时解开.我知道这只能通过JavaScript实现.我是JavaScript的初学者,所以越容易越好.JSFIDDLE就在这里.

HTML如下:

   <section class="main">
     <div id="wrap">
        <div id="featured">
     <div class="wrap">      
  <div class="textwidget">
    <div class="cup"><img src="#""></div>
<div id="header"></div></div></div></div></div></div></div>
<div class="whiteboard">
         <h1><a href="#">HELLO GUYS</a></h1> </div>
   </div>
          <div class="bg1">
            <h2> WE ARE AN EVENTS MANAGEMENT COMPANY BASED IN LONDON. </h2></div>
Run Code Online (Sandbox Code Playgroud)

CSS如下:

      .main{text-align:center;}

      h1{
          -webkit-font-smoothing: antialiased;
              display:inline-block;
            font: 800 1.313em "proxima-nova",sans-serif; 
            padding: 10px 10px;
            margin: 20px 20px;
            letter-spacing: 8px;
            text-transform: uppercase;
              font-size:3.125em;
              text-align: center; 
              max-width: 606px;
      line-height: 1.45em;
      position: scroll;
          background-color:#e94f78;
          text-decoration: none;
          color:yellow;
          background-image:url;
      }

      h1 a{
        text-decoration: none;
        color:yellow;
                padding-left: 0.15em; …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

28
推荐指数
5
解决办法
10万
查看次数

任何Android模拟器都支持OpenGL ES顶点阵列对象吗?

我一直在尝试运行使用Android NDK在C++中使用VAO并在模拟器上运行的代码.我希望能够使用glDeleteVertexArraysOES,glGenVertexArraysOESglBindVertexArrayOES.

我发现模拟器无法运行代码,即使我使用OpenGL ES 2并使用此解决方案动态链接扩展:Android OpenGL ES 2.0中是否支持使用扩展的顶点数组对象?

我运行glGetString(GL_EXTENSIONS)了运行API Level 19和GPU加速的Nexus 4仿真器并获得了以下信息:

GL_EXT_debug_marker
GL_OES_EGL_image
GL_OES_depth24
GL_OES_depth32
GL_OES_element_index_uint
GL_OES_texture_float
GL_OES_texture_float_linear
GL_OES_compressed_paletted_texture
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_depth_texture
GL_OES_texture_half_float
GL_OES_texture_half_float_linear
GL_OES_packed_depth_stencil
GL_OES_vertex_half_float
Run Code Online (Sandbox Code Playgroud)

我假设我需要看到GL_OES_vertex_array_object才能使用顶点数组对象.因此,对于那个特定的模拟器来说,这似乎是不可取的.

你知道在任何现有的Android模拟器(第三方或其他)上是否可以在OpenGL ES中使用顶点数组对象?如果是这样,怎么样?

c++ android opengl-es android-emulator

14
推荐指数
1
解决办法
1105
查看次数

Android模拟器是否支持OpenGL ES 3.0?

我知道模拟器在SDK工具17和Android 4.0.3中支持OpenGL ES 2.0,但这是在2012年4月推出的.

Android模拟器是否支持OpenGL ES 3.0,还是我们还在等待?
如果没有,是否有任何其他第三方仿真器/模拟器(例如Genymotion)支持OpenGL ES 3.0?

android opengl-es android-emulator opengl-es-3.0

13
推荐指数
2
解决办法
1万
查看次数

javax.net.ssl.sslpeerunverifiedexception没有对等证书

我试图通过从Android应用程序向PHP服务器发布数据来将记录插入MySQL.我已经向AndroidManifest.xml添加了INTERNET权限

我明白了 javax.net.ssl.SSLPeerUnverifiedException: No peer certificate

Android代码

private void senddata(ArrayList<NameValuePair> data)
{
    try 
    {
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("https://10.0.2.2/insert222.php");
        httppost.setEntity(new UrlEncodedFormEntity(data));
        HttpResponse response = httpclient.execute(httppost);

    }
    catch (Exception e) {
        // TODO: handle exception
        Log.e("log_tag", "Error:  "+e.toString());
    }
}
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗?

ssl https android

12
推荐指数
1
解决办法
3万
查看次数

Gradle不会将gdbserver打包到apk中.ndk-gdb导致"错误:目标设备上安装了不可调试的应用程序"

在Android Studio 0.6中,我创建了一个android测试项目,其中包含一个用JNI包装的非常简单的C函数.我订android:debuggable="true"AndroidManifest.xml.

我跑ndk-build NDK_DEBUG=1.这会在正确的位置生成一个gdbserver和一个gdb.setup文件.

在此输入图像描述

但是,当我在Android studio中构建项目时,ndk-gdb --debug我得到了以下输出:

Android NDK installation path: /usr/local/android-ndk-r9d
Using default adb command: /Applications/Android Studio.app/sdk/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.31
Using ADB flags:
Using JDB command: /usr/bin/jdb
Using auto-detected project path: .
Found package name: com.example.testndk.app
ABIs targetted by application: armeabi-v7a
Device API Level: 19
Device CPU ABIs: armeabi-v7a armeabi
Compatible device ABI: armeabi-v7a
Using gdb setup init: ./libs/armeabi-v7a/gdb.setup
Using toolchain …
Run Code Online (Sandbox Code Playgroud)

android android-ndk ndk-gdb android-studio android-gradle-plugin

10
推荐指数
1
解决办法
5828
查看次数

WiFiDirect discoverServices因错误3而失败(NO_SERVICE_REQUESTS)

我正在使用WiFi P2P进行网络服务发现,我按照开发人员指南中的说明进行操作.这是我的服务类中的相关代码:

public void onCreate() {
    manager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);
    channel = manager.initialize(this, getMainLooper(), null);
    registerP2pService();
    lookForServices();
}

private void registerP2pService() {
    WifiP2pDnsSdServiceInfo serviceInfo =
            WifiP2pDnsSdServiceInfo.newInstance("_service.name", "_presence._tcp", new HashMap<String, String>());

    manager.addLocalService(channel, serviceInfo, new WifiP2pManager.ActionListener() {
        @Override
        public void onSuccess() {
            Log.i("tag", "REGISTERED SERVICE");
        }

        @Override
        public void onFailure(int arg0) {
            Log.e("tag", "FAILED to register service");
        }
    });
}

private void setServiceListeners() {
    WifiP2pDnsSdServiceRequest serviceRequest = WifiP2pDnsSdServiceRequest.newInstance();
    manager.addServiceRequest(channel, serviceRequest,
        new WifiP2pManager.ActionListener() {
        @Override
        public void onSuccess() {
            Log.d("SCOPE", "Added …
Run Code Online (Sandbox Code Playgroud)

android service-discovery android-service wifi-direct wifip2p

6
推荐指数
2
解决办法
2372
查看次数

Android OpenGL ES 2.0是否支持使用扩展的顶点数组对象?

我正在尝试使用Android NDK编写一些在C++中使用VAO的代码.我希望能够使用glDeleteVertexArraysOES,glGenVertexArraysOESglBindVertexArrayOES.

我包括OpenGL ES 2的标题和我标题中的扩展名.

#define GL_GLEXT_PROTOTYPES
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
Run Code Online (Sandbox Code Playgroud)

我也在加入OpenGL ES 2 Android.mk.

LOCAL_LDLIBS += -lGLESv2
Run Code Online (Sandbox Code Playgroud)

但由于某些原因,当链接代码时,它会失败.

undefined reference to 'glDeleteVertexArraysOES'
undefined reference to 'glGenVertexArraysOES'
undefined reference to 'glBindVertexArrayOES'
Run Code Online (Sandbox Code Playgroud)

链接器不包括GLES2/gl2ext.h

c++ opengl android opengl-es android-ndk

5
推荐指数
1
解决办法
3779
查看次数

你如何检索WiFi直接MAC地址?

我正在尝试检索Android设备的MAC地址.如果启用了WiFi,通常可以通过WiFiManager API实现.

如果WiFi关闭且WiFi Direct打开,有没有办法获取MAC地址?WiFi和WiFi Direct无法在手机上同时打开.

谢谢

android wifi-direct

3
推荐指数
1
解决办法
5317
查看次数