创建布局作为给定的屏幕截图

时间:2012-10-16 05:28:43

标签: android android-layout

我正在尝试创建屏幕截图中显示的布局。这是一个警报对话吗?我通过创建警报对话框来尝试它,但对话框宽度并没有占据整个屏幕宽度。

enter image description here

1 个答案:

答案 0 :(得分:0)

您应该使用上面显示的G​​UI元素构建一个xml布局文件。

稍后你应该在你的java类中夸大这些元素。

前:

public class Header extends RelativeLayout   {
//default relative layout constructors here and call init(defined below) in each constructor.

 init() {
   LayoutInflater.from(mContext.getApplicationContext()).inflate(R.layout.yourxmlfile, this);
   btnLogo = (Button) findViewById(R.id.btnLogo);
   etSearch = (TextView) findViewById(R.id.etSearch);
   btnSearch = (Button) findViewById(R.id.btnSearch);
   mHandler = new Handler(); // for handling focus
   setListeners();// set your listeners here 
  }
 }