java http://li2.me/2016/08/make-a-reusable-ui-in-android-app-development.html

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java http://li2.me/2016/08/make-a-reusable-ui-in-android-app-development.html相关的知识,希望对你有一定的参考价值。

/**
 * Created by weiyi.li on 2/19/16.
 * http://li2.me/2016/08/make-a-reusable-ui-in-android-app-development.html
 */
public abstract class BasicOperationActivity extends BasicActivity {
    private ToggleButton mOperationBtn1;
    private ToggleButton mOperationBtn2;

    /** Override this method to inflate bottom toolbar layout. */
    @Override
    protected ViewStub inflateOperationToolbar() {
        ViewStub stub = super.inflateOperationToolbar();
        stub.setLayoutResource(R.layout.toolbar_operation);
        View view = stub.inflate();

        mOperationBtn1 = (ToggleButton) view.findViewById(R.id.operation1);
        mOperationBtn1.setOnClickListener(new DebouncedOnClickListener() {
            @Override
            public void onDebouncedClick(View v) {
                onOperationButton1Clicked();
            }
        });

        mOperationBtn2 = (ToggleButton) view.findViewById(R.id.operation2);
        mOperationBtn2.setOnClickListener(new DebouncedOnClickListener() {
            @Override
            public void onDebouncedClick(View v) {
                onOperationButton2Clicked();
            }
        });

        return stub;
    }

    /**
     * Callback when OperationBar's Button_1 & Button_2 clicked.
     * Subclass must override these two methods to do more things.
     */
    protected abstract void onOperationButton1Clicked();
    protected abstract void onOperationButton2Clicked();
}

以上是关于java http://li2.me/2016/08/make-a-reusable-ui-in-android-app-development.html的主要内容,如果未能解决你的问题,请参考以下文章

Java 布尔运算

java [Java] Java常用代码#java

Java - 35 Java 实例

Java While 循环

Java 字符串

Java If ... Else