Android Layout Binder (online View find in XML to generate java code)

Source: Internet
Author: User

 


A graph has a truth, for example:



Suppose your XML is like this:



Android: layout_width = fill_parent
Android: layout_height = fill_parent
Android: orientation = vertical>


Android: id = @ + id/logo
Android: layout_width = fill_parent
Android: layout_height = wrap_content
Android: background = @ drawable/ic_logo/>


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 = version: 1.0.0
Android: background = @ drawable/bg_version_btn/>


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/>


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 = Email: bd@che08.com
Android: textColor = @ color/colA0A0A0
/>



The generated code is as follows:
// 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 );
}





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.