<resources xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. --> <style name="AppBaseTheme" parent="android:Theme.Light"> <!-- Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. --> </style> <!-- Application theme. --> <style name="AppTheme" parent="AppBaseTheme"> <!-- All customizations that are NOT specific to a particular API-level can go here. --> </style> <style name="bottom_button"> <item name="android:background" >@drawable/colorwheel</item> <item name="android:padding">0dp</item> <item name="android:gravity">center</item> </style> </resources> 定义一个bottom_button然后在控件下style="@style/bottom_button"
<ImageButton
android:id="@+id/homeTestAnytimeImageBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
android:contentDescription="@string/test_anytime"
android:src="@drawable/ic_home_tool"
android:padding="0dp"
android:layout_margin="0dp" />主题去掉了 所有影响都没了 为什么一张方形图片上下居然有间隙 搞不懂 难道安卓界面都是写固定值不成 这自适应也太堪忧了吧
linearlayout的高度如果设置成wrap_content,高度是会随着layout里的子view的高度变高的。
我知道 但是不能调间隙 需要间隙的时候自己会设置不是么 可是自定义呢 比如说我需要间隙比他默认的小呢 不是没法设置了 设置一个固定值什么的还要去剪掉他的默认的 不是很麻烦么? 而且设置padding和margin居然无法覆盖 这点就有点抓狂了啊
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style> <!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="bottom_button">
<item name="android:background" >@drawable/colorwheel</item>
<item name="android:padding">0dp</item>
<item name="android:gravity">center</item>
</style> </resources>
定义一个bottom_button然后在控件下style="@style/bottom_button"