<LinearLayout xmlns: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:orientation="vertical" tools:context=".MainActivity" > <Button android:id="@+id/bt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="按钮" /> <TextView android:id="@+id/tv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="25sp" /> </LinearLayout>
package com.example.openproject01afinalactivity; import net.tsz.afinal.FinalActivity; import net.tsz.afinal.annotation.view.ViewInject; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends FinalActivity { @ViewInject(id = R.id.bt, click = "btClick") Button bt; @ViewInject(id = R.id.tv) TextView tv; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void btClick(View v) { tv.setText("Afinal开源框架中 \nFinalActivity的使用!"); } }
Afinal开源框架中FinalActivity的使用,布布扣,bubuko.com
原文地址:http://blog.csdn.net/feecooling/article/details/37757495