Android Layout Binder(在线将XML中View find出来,生成java代码的工具)
废话不多说,这是地址:http://android.lineten.net/layout.php。
有图有真相,比如:
你的XML假如是这样:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/logo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_logo" />
<Button
android:id="@+id/version_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/logo"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_54"
android:textColor="@color/colFFFFFF"
android:textSize="18sp"
android:text="版本号:1.0.0"
android:background="@drawable/bg_version_btn" />
<TextView
android:id="@+id/companyname_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@color/transparent"
android:text="@string/companyname"
android:textColor="@color/col8d8d8d"
android:layout_marginBottom="@dimen/font_size_40"
android:textSize="14sp" />
<TextView
android:id="@+id/email_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/dp_22"
android:text="邮箱:bd@che08.com"
android:textColor="@color/colA0A0A0"
/>
</RelativeLayout>
生成代码例如以下:
// Content View Elements
private ImageView mLogo;
private Button mVersion_btn;
private TextView mCompanyname_tv;
private TextView mEmail_tv;
// End Of Content View Elements
private void bindViews() {
mLogo = (ImageView) findViewById(R.id.logo);
mVersion_btn = (Button) findViewById(R.id.version_btn);
mCompanyname_tv = (TextView) findViewById(R.id.companyname_tv);
mEmail_tv = (TextView) findViewById(R.id.email_tv);
}
最新文章
- SQL Server数据库镜像的页面自动修复原理
- 突破瓶颈,对比学习:Eclipse开发环境与VS开发环境的调试对比
- IOS 线程处理 子线程
- 检索COM 类工厂中 CLSID 为 {} 的组件时失败
- JS练习题1共7题
- poj 2632 Crashing Robots
- ThinkPHP目录结构
- 【javascript 函数基础知识】
- 两种动态载入修改后的python模块的方法
- 今天刚申请成为Uber司机 已经接了5单了....大家有什么想问的吗?
- 使用jquery+一般处理程序异步载入信息
- Java内存模型_顺序一致性
- java 多态 向上 向下转型
- 使用loadrunner编写webservice接口请求
- Kubernetes集群搭建之企业级环境中基于Harbor搭建自己的私有仓库
- oracle中next_day()、last_day()函数解析
- Linux基础实践
- UVALive5874 - Social Holidaying-二分图匹配/匈牙利算法
- 正则的使用及replace细讲
- cxgrid中,如何根据列名或字段名取得footer值