1. android 怎麼改鍵盤按鍵
首先,保證手機已經ROOT,並且安裝了RE文件管理器,先用RE管理器打開system\usr\keylayout下的文件s3c-keypad.kl(以文本編輯方式打開),在目錄中不同的數字對應不同的功能,看好原先對應的功能,在將數字按照喜歡的風格進行重新編寫:
1.
116代表鎖屏鍵
2.
102代表寶石鍵
3.
231代表撥號鍵
4.
217代表相機上面的鍵
5.
26代表掛機鍵
6.
115代表音量+
7.
114代表音量-
8.
158代表相機鍵
9.
改完立刻重啟就OK了。
2. 如何設置button字體 android
使用方法
第一種是在listview中配置android:listSelector=」@drawable/list_item_bg」
第二種是在listview的item中添加屬性android:background=」@drawable/list_item_bg」
第三種是java代碼中使用:
Drawable drawable = getResources().getDrawable(R.drawable.list_item_bg);
listview.setSelector(drawable);
註:列表有時候為黑的情況,需要加上下面的代碼使其透明:
android:cacheColorHint="@android:color/transparent"
使用selector設置字體顏色
drawable/button_font.xml
<?xmlversion="1.0"encoding="utf-8"?>
<selectorxmlns:android="http://schemas.android.com/apk/res/android">
<itemandroid:state_selected="true"android:color="#FF0000"/>
<itemandroid:state_focused="true"android:color="#00FF00"/>
<itemandroid:state_pressed="true"android:color="#0000FF"/>
<itemandroid:color="#000000"/>
</selector>
使用方法
android:textColor="@drawable/button_color"
更復雜的效果
還可以實現更復雜的效果,例如漸變等等。drawable/button_color.xml
<?xmlversion="1.0"encoding="utf-8"?>
<selectorxmlns:android="http://schemas.android.com/apk/res/android">
<itemandroid:state_pressed="true">
<!--定義當button處於pressed狀態時的形態。-->
<shape>
<gradientandroid:startColor="#8600ff"/>
<strokeandroid:width="2dp"
android:color="#000000"/>
<cornersandroid:radius="5dp"/>
<paddingandroid:left="10dp"
android:top="10dp"
android:bottom="10dp"
android:right="10dp"/>
</shape>
</item>
<itemandroid:state_focused="true">
<!--定義當button獲得focus時的形態-->
<shape>
<gradientandroid:startColor="#eac100"/>
<strokeandroid:width="2dp"
android:color="#333333"
color="#ffffff"/>
<cornersandroid:radius="8dp"/>
<paddingandroid:left="10dp"
android:top="10dp"
android:bottom="10dp"
android:right="10dp"/>
</shape>
</item>
</selector>
使用方法
android:background="@drawable/button_color"
android:focusable="true"
3. android Button 按下之後文字顏色改變
添加一個selecter選擇器,然後設置textColor的時候選擇自定義的這個選擇器
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/activity_main_tabselected" android:state_pressed="true" android:state_checked="true"/>
<item android:color="@color/activity_main_tabselected" android:state_pressed="true" android:state_checked="false"/>
<item android:color="@color/activity_main_tabselected" android:state_pressed="false" android:state_checked="true"/>
<item android:color="@color/activity_main_tabnormal" android:state_pressed="false" android:state_checked="false"/>
</selector>
4. Android的Button可以實現動態改變button的文字嗎
當然可以 Button button.setText("動態文字"); 執行setText方法即可修改按鈕的文字
5. android按鈕點擊改變文本值再次點擊又變回原來的文本!
public class MainActivity extends ActionBarActivity {//首先創建了一個activity
//用來展示文字的textview(可以理解成帶有文字的按鈕)
private TextView textView;
String str1 = "原來的文本";
String str2 = "點擊後的文本";
@Override
protected void onCreate(Bundle savedInstanceState) {//activity初始化
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);//載入布局文件
textView = (TextView) findViewById(R.id.textView);//初始化這個用來展示文字的textview(這個textview要在R.layout.activity_main裡面定義)
textView.setText(str1);//設置原來的文本
textView.setTag(false);//標記textview為false(表示沒有被點擊過)
textView.setOnClickListener(new OnClickListener() {//注冊監聽器
@Override
public void onClick(View v) {
boolean flag = (boolean) textView.getTag();//當點擊時,首先判斷是否已經點擊過
if(!flag){//沒有被點擊過
textView.setText(str2);
textView.setTag(true);
}else{//已經點擊過了
textView.setText(str1);
textView.setTag(false);
}
}
});
}
}
6. android點擊按鈕之後改變按鈕的文字
想在android點擊按鈕之後改變按鈕的文字需要給按鈕添加一個監聽事件,然後一監聽到該事件再給這個按鈕調用setText()方法,在方法里可以給按鈕設置文字,具體操作如下:
1、首先使用Android studio創建一個項目,如下圖:
7. androidanimatons怎麼通過註解的方式改變button的文字
1. <!? ?> :注釋 每一個HTML標簽都有其用法,但我們在寫HTML代碼時,卻常常舍近求遠,忽略了很多非常重要且特別有用的標簽。 既然HTML中定義了這么多標簽,而且每種標簽都有其用法,我們為什麼不盡量去使用這些標簽呢。下面收集並整理了36個常被我們遺忘卻非常有用的HTML標簽。 2. <!DOCTYPE>:文檔類型聲明 文檔類型,會使瀏覽器使用相應的方式載入網頁並顯示,忽略DTDs,將使網頁進入一種混亂模式(quirks mode)。 示例: XHTML過渡定義類型,此類型可以使用HTML4中的標簽 XHTML嚴格定義類型,此文檔只可以使用XHTML1中定義的標簽 XHTML1.1版定義類型 XHTML框架定義類型。(可以使用框架) 3. <abbr>:縮寫 示例:<abbr title=”Limited”>Ltd.</abbr> 說明:簡稱和縮寫是對一個慣用片語的縮寫表示,一般使用片語中每個單詞的首字母,比如CSS(Cascading Style Sheets),而HTML(Hypertext Markup Language)就不是一種提取首字母的縮寫.有時候縮寫經常會在最後加一個。 4. <acronym>: 取首字母的縮寫 示例:<acronym title=”Cascading Style Sheets”>CSS</acronym> 5. <area>: 定義圖像點擊區域 area標簽是單獨出現的,<area /> area標簽必須使用在map標簽中,而且必須配合img標簽使用。 屬性: Common ― 一般屬性 accesskey ― 鏈接的快捷鍵訪問方式 alt ― 圖像的提示文字 coords ― 定義可點擊區域圖形的坐標 href ― HTML鏈接源的URL nohref ― 圖像點擊排除的區域,當不使用href時應使用nohref shape ― 可點擊區域的形狀 tabindex ― 使用”Tab”鍵的遍歷順序 target ― 鏈接目標 area是client-side image map area的意思,區域 area標簽示例: <img src=”/images/logo.png” usemap=”#Map” /> <map name=”Map” id=”Map”> <area shape=”rect” coords=”35,29,135,99″ href=”#” /> <area shape=”circle” coords=”243,78,44″ href=”#” /> <area shape=”poly” coords=”120,137,195,154,135,207″ href=”#” /> </map> 6. <base>: 定義基URL用於頁面的鏈接與引用 base標簽是單獨出現的,<base /> base標簽只能放置在head標簽內 當使用相對路徑定義鏈接時,可以使用base標簽定義基URL解析所有文檔中定義的相對路徑的URL 屬性: href ― 基URL target ― 鏈接目標 base是document base URI的意思 base標簽示例 <head> <base href=”/” target=”_blank”> </head> 使用上面示例代碼的html頁面中的相對鏈接,將直接指向基URL /,並且使用彈出窗口。 base標簽在框架中的使用 base標簽通常可以使用在框架鏈接中,例如 <frameset cols=”20%, *”> <frame src=”list.html”> <frame src=”/” name=”mainTarget”> < /frameset> 鏈接頁list.htm l<head> <base target=”mainTarget”> </head> < a href=”/category/design/”>design</a> < a href=”/category/graphic/”>graphic</a> <a href=”/category/inspiration/”>inspiration</a> <a href=”/category/freebies/”>freebies</a> 通過上面示例可以避免在每個鏈接中寫入target=”mainTarget” 7. <blockquote>:表示引用塊 blockquote標簽是成對出現的,以<blockquote>開始,以</blockquote>結束 屬性: Common ― 一般屬性 cite ― 被引用內容的URI 示例: <blockquote cite=”/xhtml/”> <p>標准網頁設計要區分內容與表現,學習標准網頁設計。</p> </blockquote> 8. <button> :定義按鈕 button標簽是成對出現的,以<button>開始,</button>結束 可以定義比input內容更豐富的按鈕。 屬性: Common ― 一般屬性 accesskey ― 快捷鍵訪問方式 disabled ― 禁止使用 name ― 標簽名稱 tabindex ― 使用”Tab”鍵的遍歷順序 type ― 按鈕類型 button ― 普通按鈕 reset ― 重置表單按鈕 submit ― 提交按鈕 value ― 通過表單傳遞到伺服器端的數據 button是push button的意思,按鈕 button標簽示例: <button type=”submit”>提交</button> 一個使用文字的普通的提交按鈕 <button type=”reset”> 從<strong>任鳥飛</strong>提交表單 </button> 改變按鈕內加重文字的button標簽 <button type=”button”> <img src=”renniaofei.png”
8. android怎麼改變button中字體的格式
使用方法 第一種是在listview中配置android:listSelector=」@drawable/list_item_bg」 第二種是在listview的item中添加屬性android:background=」@drawable/list_item_bg」 第三種是java代碼中使用: Drawable drawable = getResources()/apk/res/android">" target="_blank">schemas/apk/res/android"></a> <item android:state_selected="true" android:color="#FF0000" /> <item android:state_focused="true" android:color="#00FF00" /> <item android:state_pressed="true" android:color="#0000FF" /> <item android:color="#000000" /></selector>使用方法 android:textColor="@drawable/button_color" 更復雜的效果 還可以實現更復雜的效果,例如漸變等等。 drawable/button_color/apk/res/android">" target="_blank">schemas/apk/res/android"></a> <item android:state_pressed="true"> <!-- 定義當button 處於pressed 狀態時的形態。--> <shape> <gradient android:startColor="#8600ff" /> <stroke android:width="2dp" android:color="#000000" /> <corners android:radius="5dp" /> <padding android:left="10dp" android:top="10dp" android:bottom="10dp" android:right="10dp"/> </shape> </item> <item android:state_focused="true"> <!-- 定義當button獲得 focus時的形態 --> <shape> <gradient android:startColor="#eac100"/> <stroke android:width="2dp" android:color="#333333" color="#ffffff"/> <corners android:radius="8dp" /> <padding android:left="10dp" android:top="10dp" android:bottom="10dp" android:right="10dp"/> </shape> </item></selector>使用方法 android:background="@drawable/button_color" android:focusable="true"
9. android 點擊按鈕之後按鈕上的文字改變,是在不同的頁面上改變,請詳細說明下
我不是太清楚你的意思
不同頁面上改變,可以用intent傳值
第一個頁面:
bt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
//傳值
Intent in=new Intent();
//鍵值對
in.putExtra("extra", "chenggong le!!!!!");
//從此ctivity傳到另一Activity
in.setClass(MainActivity.this, Main2Activity.class);
//啟動另一個Activity
MainActivity.this.startActivity(in);
}
} );
第二個頁面:
setContentView(R.layout.activity_main2);
Button bt=(Button)findViewById(R.id.bt02);
//取值
Intent intent=getIntent();
String stringValue=intent.getStringExtra("extra");
//button文字改變
bt.setText(stringValue);
10. Android中如何永久設置button的文字
用sharedpreferences存下來,每次啟動查這個值,修改button值?