Android Studio全屏宽度与操作栏宽度

时间:2018-11-07 20:34:11

标签: java android

我要使用此代码从头到尾放置n张图像

DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
height = displayMetrics.heightPixels;
width = displayMetrics.widthPixels;
width_imagine =(int)  (width/n);
LinearLayout.LayoutParams layoutParams = new 
LinearLayout.LayoutParams(width_imagine, 100);
imagine.setLayoutParams(layoutParams);

image without action bar

因为操作栏在那里,我无法获得精确的宽度。 enter image description here 如何获得整个屏幕的宽度?

1 个答案:

答案 0 :(得分:0)

尝试此代码:

program substituire_A;
var s:string; i:integer;
begin writeln('Dati sirul');
readln(s); for i:=1 to length(s) do
if s[i]='A' then s[i]:='*';
writeln('sirul obtinut este=',s);
readln`enter code here`
end.