Project Address: http://www.aoeai.com:8081/android-code-generator/
1. Select the layout file that you want to generate code for, for example:
<?xml version= "1.0" encoding= "Utf-8"?><linearlayout xmlns:android="Http://schemas.android.com/apk/res/android" Android:layout_width="Match_parent"android:layout_height="Match_parent" Android:orientation="vertical"android:gravity="Center_horizontal"> <include layout="@layout/toolbar" /> <Viewandroid:layout_width= "match_parent"android:layout_height=" 1DP "android:layout_margintop=" @dimen/dp_16 " /> <TextView Android:id="@+id/tv_title" Android:layout_width="Match_parent" Android:layout_height="Wrap_content" android:textsize="@dimen/char_16" Android:textcolor="@color/char_black" android:padding="@dimen/dp_16" Android:text="The system upgrade to your trouble, welcome to download the latest version from the following markets" android:textisselectable="true" Android:layout_marginleft="@dimen/dp_16" Android:layout_marginright="@dimen/dp_16"/> <Viewandroid:layout_width= "match_parent"android:layout_height=" 1DP "android:layout_margintop=" @dimen/dp_16 " /> <TextView Android:id="@+id/market" Android:layout_width="Match_parent" Android:layout_height="Wrap_content" android:textsize="@dimen/char_16" Android:textcolor="@color/char_black" android:padding="@dimen/dp_16" Android:text="Google" android:textisselectable="true" Android:layout_marginleft="@dimen/dp_16" Android:layout_marginright="@dimen/dp_16"/> <buttonandroid:id="@+id/btn_submit"android:layout_width="Wrap_ Content "android:layout_height=" Wrap_content "android:text=" Commit "/ > </linearlayout>
2. Copy the layout file code containing the ID into the input box, then click Submit to generate Java code
The results are as follows:
Instructions for using the Android code generator