ビットマップ(setViewの要素)をImageView
に入れて表示します。私たちは、アプリケーションを実行すると、単に黒の背景にエラーはありません。ImageViewはAndroidでビットマップを表示しません
public void setView(View element) {
mainView = element;
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
mainView.setVisibility(View.VISIBLE);
setContentView(element);
try {
rootLayout.addView(mainView,layoutParams);
}catch (Exception e){
e.printStackTrace();
}
}
これは私たちののonCreate
@Override
protected void onCreate(Bundle savedInstanceState) {
this.getInstance();
this.authService = new AuthenticationService();
this.authService.getInstance(this);
this.settingsManager = SettingsManager.getInstance();
this.statusManager = StatusManager.getInstance();
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
mainView = findViewById(R.id.mainContentView);
loadingView = null;
mInflater = (LayoutInflater) AuthenticationService.getContext().getSystemService(LAYOUT_INFLATER_SERVICE);
vs = (View) mInflater.inflate(R.layout.activity_main, null);
rootLayout = (RelativeLayout) vs.findViewById(R.id.rootLayout);
AsyncCallRegistrationWS task = new AsyncCallRegistrationWS();
task.execute();
}
である私たちは、StackOverflowの上でこの問題へのすべての提案された解決策を試してみましたが、何も私たちのために働きました。
EDIT:私たちは別のクラスでsetviewコマンドを()を呼び出し
public void createDisplay(){
creationDate = DateTime.now();
try {
if (state == DisplayState.Validated){
if (entry != null && entry.template != null){
DateTime now = DateTime.now();
if (SettingsManager.getInstance().playlistTimeOffset != null){
now.plus(SettingsManager.getInstance().playlistTimeOffset);
}
}
WindowManager wm = (WindowManager) AuthenticationService.getContext().getSystemService(Context.WINDOW_SERVICE);
android.view.Display screenDisplay = wm.getDefaultDisplay();
int width = screenDisplay.getWidth();
int height = screenDisplay.getHeight();
View element = create(width,height);
if (element != null){
StartUpActivity.getInstance().setView(element);
state = DisplayState.Created;
if (contentState == DisplayContentState.Unknown){
contentState = DisplayContentState.Valid;
}
} else {
destroyDisplayOnFail();
}
}
} catch (Exception e){
Log.e(LOG_TAG, "Creating display failed. "+getLoggingContentIdentificationString()+" "+e.toString());
destroyDisplayOnFail();
}
}
ここから 'setView'メソッドを呼び出していますか? –
@UttamPanchasara editted –
あなたの 'setContentView(R.layout.activity_main)'とインフレータブルレイアウト 'vs =(View)mInflater.inflate(R.layout.activity_main、null);はどちらも同じですか? –