"createViews"를 올바르게 재정의하는 방법을 알려주십시오. @Override를 앞에두면 다음과 같이 표시됩니다. "WhatSnap 유형의 메소드 createViews()가 슈퍼 유형 메소드를 대체 또는 구현해야합니다." @Override를 삭제하면 실행되지 않습니다. 이 첫 번째 클래스입니다 : https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaActivity.java#L267함수를 재정의하는 방법은 무엇입니까?
그리고 이것은 내가 createViews를 오버라이드 (override) 할 느릅 나무에서 두 번째로 하나입니다
package com.Snap.What;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.widget.RelativeLayout;
import org.apache.cordova.*;
import com.startapp.android.publish.StartAppAd;
import com.startapp.android.publish.StartAppSDK;
import com.startapp.android.publish.banner.Banner;
public class WhatSnap extends CordovaActivity
{
private CordovaWebView cordova_webview;
private StartAppAd startAppAd = new StartAppAd(this);
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.init();
// Set by <content src="index.html" /> in config.xml
super.loadUrl(Config.getStartUrl());
//super.loadUrl("file:///android_asset/www/index.html");
StartAppSDK.init(this, "xxx", "xxx", true);
Log.e("activity", "activity");
}
@Override
protected void createViews(){
RelativeLayout layout = new RelativeLayout(this);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.MATCH_PARENT);
layout.setLayoutParams(lp);
appView.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT));
Log.e("createViews", "createViews");
appView.setVisibility(View.INVISIBLE);
layout.addView((View) appView);
setContentView(layout);
Banner startAppBanner = new Banner(this);
RelativeLayout.LayoutParams bannerParameters =
new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
bannerParameters.addRule(RelativeLayout.CENTER_HORIZONTAL);
bannerParameters.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
// Add to main Layout
layout.addView(startAppBanner, bannerParameters);
}
@Override
protected CordovaWebView makeWebView(){
Log.e("CordovaWebView", "CordovaWebView");
return new CordovaWebView(WhatSnap.this);
}
}
그냥 l0oky @ .. 보호에 –
을 createViews의 서명을 변경! –