java: load xml file resource to display an image

This commit is contained in:
rafal1137 2020-06-23 23:17:36 +02:00
parent 4752d41532
commit c1904cab07

View file

@ -101,14 +101,12 @@ public class ETLMain extends Activity {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
ImageView imageView = new ImageView(this);
imageView.setBackgroundResource(R.drawable.ic_horizontal_black);
imageView.setBackgroundResource(R.drawable.ic_horizontal_white);
LinearLayout etl_Layout = new LinearLayout(this);
RelativeLayout.LayoutParams etl_Params = new RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
etl_Params.topMargin = pxToDp(Resources.getSystem().getDisplayMetrics().heightPixels / 2);
RelativeLayout.LayoutParams etl_Params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
1024);
etl_Layout.addView(imageView, etl_Params);
setContentView(etl_Layout);