Android 自定义主题没有';按钮上的t效应

Android 自定义主题没有';按钮上的t效应,android,android-button,android-theme,Android,Android Button,Android Theme,我有一个主题文件来应用我所有的按钮。下面的代码在我的主题文件中 <style name="CustomButton" parent="@android:style/Widget.Holo.Light.Button"> <item name="android:textSize">14sp</item> <item name="android:layout_width">72dp</item>

我有一个主题文件来应用我所有的按钮。下面的代码在我的主题文件中

    <style name="CustomButton" parent="@android:style/Widget.Holo.Light.Button">
        <item name="android:textSize">14sp</item>
        <item name="android:layout_width">72dp</item>
        <item name="android:layout_height">32dp</item>
        <item name="android:background">@drawable/button_selector</item>
    </style>
   <style name="MyTheme" parent="@android:style/Theme.Holo.Light">
        <item name="android:buttonStyle">@style/CustomButton</item>
   </style>

14便士
72dp
32dp
@可拉拔/按钮选择器
@样式/自定义按钮
在@drawable/button_选择器中

<selector>
    <item android:drawable="@drawable/btn_bg">
        <shape>
            <size android:width="72dip" android:height="32dip"/>
            <stroke
                android:width="1dp"
                android:color="#992f2f" />
            <corners
                android:radius="3dp" />
        </shape>
    </item>
</selector>

在我的布局文件中

<Button android:id="@+id/savebtn" 
       android:layout_width="wrap_content" android:layout_marginRight="15dip"
       android:layout_height="wrap_content"
       android:text="Save"/>

我的问题是按钮的宽度和高度没有改变。当我在savebtn中直接设置layout_(72dp)和layout_高度(32dp)时,它就工作了。我已经在应用程序标记中定义了主题文件。我不想把我所有的按钮都设置成那样。我想知道有什么建议或想法吗

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.myproject"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="15" />

    <application 
        android:label="@string/app_name"
        android:theme="@style/MyTheme">
        <activity
            android:name=".activity.setting.SettingActivity"
            android:label="@string/menu_settings" >
        </activity>
     <activity
            android:name=".activity.setting.AboutActivity"
            android:label="@string/app_name" >
         </activity>    
        <activity
            android:name=".activity.DetailsActivity"
            android:label="@string/app_name" >
           <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
       </activity>      

    </application>

</manifest>

我准确地测试了您的代码,它运行正常

您是否在AndroidManifest.xml上添加了以下内容

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/MyTheme" >

如果仍然不起作用,请发布您的清单


还要注意,如果您在活动中设置另一个主题,它将覆盖应用程序主题

是的。按钮大小是否根据按钮选择器中的大小更改?请发布您的AndroidManifest.xml!