<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                假設app的title如下 假設app的title 統一的都是這種左中右結構的 代碼如下 ~~~ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" style="@style/app_title_style" android:baselineAligned="false" android:gravity="center_vertical" android:orientation="horizontal"> <ViewSwitcher android:id="@+id/app_title_left_switcher" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:id="@+id/app_title_left_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="返回"/> <ImageView android:id="@+id/app_title_left_image" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </ViewSwitcher> <ViewSwitcher android:id="@+id/app_title_middle_switcher" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_marginLeft="16dip" android:layout_weight="1"> <TextView android:id="@+id/app_title_middle_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="title"/> <ImageView android:id="@+id/app_title_middle_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"/> </ViewSwitcher> <ViewSwitcher android:id="@+id/app_title_right_switcher" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:id="@+id/app_title_right_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="下一步"/> <ImageView android:id="@+id/app_title_right_image" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </ViewSwitcher> </LinearLayout> ~~~ 先來繼續完善一下BaseActivity ~~~ protected void onCreate(BundlesavedInstanceState){ super.onCreate(savedInstanceState); ActivityMgr.push(this); findViewById(); } // 初始化app中通用的控件 protected void findViewById(){ } // 設置標題欄 protected void setTitle(){ } ~~~ 然后看一下BaseActivity的具體實現類TitleDemoActivity ~~~ public class TitleDemoActivity extendsBaseActivity{ protectedvoid onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); } protectedvoid findViewById(){ setContentView(R.layout.title_demo); super.findViewById(); super.setTitle();// 設置標題欄 } } ~~~ ### TitleBar封裝 BaseActivity的設計初衷是所有的Activity的都繼承該類。 首先定義一些通用的屬性、以及方法 ~~~ private ViewSwitcher mLeftSwitcher; private ViewSwitcher mMiddleSwitcher; private ViewSwitcher mRightSwitcher; /** * 初始化View */ protected void findViewById() { mLeftSwitcher = (ViewSwitcher) findViewById(R.id.app_title_left_switcher); mMiddleSwitcher = (ViewSwitcher) findViewById(R.id.app_title_middle_switcher); mRightSwitcher = (ViewSwitcher) findViewById(R.id.app_title_right_switcher); } protected void setTitle(String left, String middle, String right) { ((TextView) mLeftSwitcher.getChildAt(0)).setText(left); ((TextView) mMiddleSwitcher.getChildAt(0)).setText(middle); ((TextView) mRightSwitcher.getChildAt(0)).setText(right); } ~~~ 子類調用 ~~~ public class TitleDemoActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override protected void findViewById() { setContentView(R.layout.title_demo); super.findViewById(); setTitle("返回主頁", "這是一個Title", "下一個界面"); } } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看