android 在標題欄加上按鈕


        public void onCreate(Bundle savedInstanceState) {   
                  super.onCreate(savedInstanceState);   
                  requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); // 注意順序   
                  setContentView(R.layout.main); // 注意順序   
                  getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,      // 注意順序   
                  R.layout.title);   
         }  
        填加title.xml代碼
        <?xml version="1.0" encoding="utf-8"?>   
        <LinearLayout   
        xmlns:android=http://schemas.android.com/apk/res/android   
        android:layout_width="wrap_content"   
        android:layout_height="wrap_content">   
              <TextView android:id="@+id/text"   
                android:layout_width="wrap_content"   
                android:layout_height="wrap_content"   
                android:layout_alignParentLeft="true"   
                android:text="text" />   
              <Button android:id="@+id/button"   
                android:layout_width="wrap_content"   
                android:layout_height="30px"   
                android:text="button" />   
        </LinearLayout>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM