• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java GVRActivity类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.gearvrf.GVRActivity的典型用法代码示例。如果您正苦于以下问题:Java GVRActivity类的具体用法?Java GVRActivity怎么用?Java GVRActivity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

GVRActivity类属于org.gearvrf包,在下文中一共展示了GVRActivity类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: EditTextSceneObject

点赞 2

import org.gearvrf.GVRActivity; //导入依赖的package包/类
/**
 * Shows a {@link TextView} on a {@linkplain GVRSceneObject scene object}.
 *
 * @param gvrContext
 *            current {@link GVRContext}
 * @param mesh
 *            A {@link GVRMesh} - see
 *            {@link GVRContext#loadMesh(org.gearvrf.GVRAndroidResource)}
 *            and {@link GVRContext#createQuad(float, float)}.
 *
 *            Please note that this mesh controls the size of your scene
 *            object, and it is independent of the size of the internal
 *            {@code TextView}: a large mismatch between the scene object's
 *            size and the view's size will result in 'spidery' or 'blocky'
 *            text.
 * @param gvrActivity
 *            a {@link GVRActivity}
 * @param viewWidth
 *            Width of the {@link TextView}
 * @param viewHeight
 *            Height of the {@link TextView}
 * @param text
 *            {@link CharSequence} to show on the textView
 */
public EditTextSceneObject(GVRContext gvrContext, GVRMesh mesh,
        GVRActivity gvrActivity, int viewWidth, int viewHeight,
        CharSequence text) {
    super(gvrContext, mesh);

    mTextView = new EditText(gvrActivity);
    mTextView.setLayoutParams(new LayoutParams(viewWidth, viewHeight));
    mTextView.measure(viewWidth, viewHeight);
    mTextView.setBackgroundColor(Color.TRANSPARENT);
    mTextView.setText(text);
    mTextView.setVisibility(View.VISIBLE);

    mTextViewContainer = new LinearLayout(gvrActivity);
    mTextViewContainer.addView(mTextView);
    mTextViewContainer.measure(viewWidth, viewHeight);
    mTextViewContainer.layout(0, 0, viewWidth, viewHeight);
    mTextViewContainer.setVisibility(View.VISIBLE);

    gvrContext.registerDrawFrameListener(mFrameListener);

    GVRTexture texture = new GVRExternalTexture(gvrContext);
    GVRMaterial material = new GVRMaterial(gvrContext, GVRShaderType.OES.ID);
    material.setMainTexture(texture);
    getRenderData().setMaterial(material);

    mSurfaceTexture = new SurfaceTexture(texture.getId());
    mSurface = new Surface(mSurfaceTexture);
    mSurfaceTexture.setDefaultBufferSize(mTextViewContainer.getWidth(),
            mTextViewContainer.getHeight());
}
 

开发者ID:mrgrimnevil,
项目名称:browser-vr,
代码行数:55,
代码来源:EditTextSceneObject.java

示例2: Browser

点赞 1

import org.gearvrf.GVRActivity; //导入依赖的package包/类
public Browser(GVRContext gvrContext, GVRActivity gvrActivity,
        float width, float height, WebView webView) {
    sceneObject = new GVRSceneObject(gvrContext);

    this.webView = webView;

    webViewObject = new NaviWebViewSceneObject(gvrContext, width, height, webView);
    webViewObject.setName("webview-"+ id++);

    sceneObject.addChildObject(webViewObject);

    float ratio = 1f / 8f;

    // text navigation bar
    EditTextSceneObject navBar = new EditTextSceneObject(gvrContext, gvrActivity,
            width, width * ratio, 1024, (int)(1024 * ratio), "");

    editText = navBar.getTextView();
    editText.setHint("Web address:");

    navBar.setBackgroundColor(Color.WHITE);
    navBar.setTextSize(20);
    navBar.setTextColor(Color.BLACK);

    navBar.getTransform().setPosition(0f, -1.3f, 0f);

    sceneObject.addChildObject( navBar );
}
 

开发者ID:mrgrimnevil,
项目名称:browser-vr,
代码行数:29,
代码来源:Browser.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)