Always feel that there is no framework for direct development of the cumbersome, Java under a lot, I use ssh,php under a lot, I use the thinkphp,delphi has not found a more appropriate, Android? Today, we searched the Internet and found that there are many good frameworks, Compare a bit, found two more useful: Afinal and xutils.
Afinal:
Http://github.com/yangfuhai/afinal
Xutils:
Https://github.com/wyouflf/xUtils
Xutils was a fork in the afinal.
Both frameworks use annotations, which is really handy:
A simple introductory introduction:
Afinal:
http://www.oschina.net/p/afinal/
From Xutils Source:
http://my.oschina.net/u/1171837/blog/147544
Friends who are interested in frames can try.
Thank the author for the Good tools!
Attach simple controls and event injection examples:
Xml:
<Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"Android:paddingbottom= "@dimen/activity_vertical_margin"Android:paddingleft= "@dimen/activity_horizontal_margin"Android:paddingright= "@dimen/activity_horizontal_margin"Android:paddingtop= "@dimen/activity_vertical_margin"Tools:context=". Mainactivity " > <TextViewAndroid:id= "@+id/tvhello"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "@string/hello_world" /> <ButtonAndroid:id= "@+id/btnhello"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_marginleft= "68DP"Android:layout_torightof= "@+id/tvhello"Android:text= "button" /></Relativelayout>
Java:
Packagecom.example.myxutils;Importandroid.app.Activity;ImportAndroid.os.Bundle;ImportAndroid.view.Menu;ImportAndroid.view.View;ImportAndroid.widget.TextView;Importcom.lidroid.xutils.ViewUtils;ImportCom.lidroid.xutils.view.annotation.ViewInject;ImportCom.lidroid.xutils.view.annotation.event.OnClick; Public classMainactivityextendsActivity {//Xutils's view annotation requires that an ID be provided so that code confusion is not affected. @ViewInject (R.id.tvhello) TextView Tvhello; @Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); Setcontentview (R.layout.activity_main); //inject in activity:Viewutils.inject ( This);//inject view and eventsTvhello.settext ("Hello,garfield!")); } @OnClick (R.id.btnhello) Public voidTestbuttonclick (View v) {//The method signature must be consistent with the requirements in the interfaceTvhello.settext ("This is a button event!")); } @Override Public BooleanOncreateoptionsmenu (Menu menu) {//inflate the menu; This adds items to the action bar if it is present.getmenuinflater (). Inflate (R.menu.main, menu); return true; } }
The code is a lot simpler!
Android Development Framework