我正在为视频门电话开发我的第一个 android 应用程序。SIP 音频和 mjpeg 视频功能正在工作我想在视频 ui 的底部添加三个按钮,但我在第三个添加的只有一个按钮。提前感谢您的任何回复
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String URL = "http://172.16.1.58/mjpg/video.mjpg";
//String URL ="http://172.16.20.20/axis-cgi/mjpg/video.cgi?camera=1&resolution=320x240";
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
mv = new MjpegView(this);
setContentView(mv);
// (1) add accept button on video screen
acceptBtn = new ImageButton(this);
acceptBtn.setImageResource(R.drawable.answer);
acceptBtn.layout(0, 0, 0, 0);
addContentView(acceptBtn, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
acceptBtn.setOnClickListener(onAccept);
// (2) add End key on video screen
endBtn = new ImageButton(this);
endBtn.setImageResource(R.drawable.end);
endBtn.layout(0, 300, 0, 0);
addContentView(endBtn, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
endBtn.setOnClickListener(onEnd);
// (3) add OpenDoor key on video screen
keyBtn = new ImageButton(this);
keyBtn.setImageResource(R.drawable.key);
keyBtn.layout(0, 600, 0, 0);
addContentView(keyBtn, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
endBtn.setOnClickListener(onOpenDoor);
new ConnectToImageServer().execute(URL);
}