我想在android系統編程添加按鈕,按鈕的XML文件將是機器人編程添加自定義按鈕佈局
<Button
android:textStyle="bold"
android:background="@drawable/blue"
android:textColor="@drawable/blue_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/funny_excuses"
android:id="@+id/funny"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:textSize="25sp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
什麼是做到這一點的最好方法是什麼? 我只會改變文本爲每一個新按鈕.. 也許我會有另一個按鈕類型,像其他的背景和文本顏色..
的可能重複的[機器人:編程添加按鈕的佈局(http://stackoverflow.com/questions/11710200/android-編程方式添加-按鈕到一個佈局) – 2Dee 2014-09-19 12:35:55
@ 2Dee沒有,一點都不像這個問題..我想添加自定義按鍵多次。與自己的設置 – 2014-09-19 12:37:43
基本上它是* *同樣的事情,你只需要應用這個http://stackoverflow.com/questions自定義樣式/ 2016249 /如何以編程方式設置樣式屬性在視圖中或以編程方式設置樣式... – 2Dee 2014-09-19 12:40:47