我正在使用拉丁键盘示例来构建我的自定义键盘。我不需要更改字体颜色和键背景颜色。我没有在代码或 xml 中找到定义颜色的位置。我似乎将其在 android 键盘类中定义为默认值。如果可以进行一些更改,请提供帮助。
问问题
684 次
1 回答
-1
go to your xml file. you should be working with something like button within a linearLayout(or may be in a table layout).
so the code should look something like this:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
*************here your code should look like this ,to color your button"***********
android:text="yourText"
//this line changs the background color
android:background="#888888" //for black or you can use any color in this format.
//this line changes the color of the text on the button
android:textColor="#ffffff"//text appears in white...
so this is the way you can manipulate your code in xml file...
if you are in java... then, first initialize your all buttons.Then you can edit any color directly from your java code... for examaple
Button btn=(Button) findViewById(R.id.button_1);
btn.setcolor(BLACK);
so,the better way is if you are working with your xml file for customization...
Hope this answers your question.`enter code here`
于 2013-07-20T09:16:19.147 回答