How to change the yellow square background when press down on a button in a GridView?
See the yellow background effect by click an icon on your android's main app menu.
Is there any way to change the style, change it to a transparent background or some oth开发者_JAVA百科er styles that looks better?
Simple..add this to the gridview tag
android:listSelector="#00000000"
gridview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
int c = Color.BLUE;
gridview.getChildAt(arg2).setBackgroundColor(c);
}});
I am not very clear with your requirement but yes you can create style in values folder.
file name style.xml
<resources>
<style name="ReviewScreenKbbNameStyle">
<item name="android:textColor">#2F2E86</item>
<item name="android:textStyle">bold</item>
<item name="android:textSize">12dip</item>
</style>
</resources>
and in your layout you can use your style like this or you can use your style in your program
<TextView
android:id="@+id/mid_bot_left_kbb_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:layout_marginLeft="20dip"
android:text="@string/kbb_name"
style="@style/ReviewScreenKbbNameStyle"/>
精彩评论