您可以通过将自定义按钮样式设置为布局来使用布局作为按钮,并可以向其添加两个textView,这样:
android:layout_height="wrap_content" style="@android:style/Widget.Button"
android:layout_width="wrap_content">
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textColor="#000">
android:layout_height="wrap_content" android:id="@+id/secondTextView"
android:layout_width="wrap_content" android:layout_marginLeft="10dp">
在Activity中你可以设置不同的字体:
Typeface font=Typeface.createFromAsset(getAssets(),"ARIALN.TTF") ;
Typeface font2=Typeface.createFromAsset(getAssets(), "COMPCTAN.TTF");
TextView firstTextView = (TextView)findViewById(R.id.firstTextView);
TextView secondTextView = (TextView)findViewById(R.id.secondTextView);
firstTextView.setTypeface(font);
secondTextView.setTypeface(font2);
LinearLayout btnLayout=(LinearLayout) findViewById(R.id.customButtonLayout);
btnLayout.setOnClickListener(this);