비트 맵 (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();
}
.
편집 : 우리는 다른 클래스에 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는 –
의'setContentView (R.layout.activity_main)'과 팽창 된 레이아웃'vs = (View) mInflater.inflate (R.layout.activity_main, null); 모두 같습니까? –