xml AndroidManifest.xml中

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml AndroidManifest.xml中相关的知识,希望对你有一定的参考价值。

<!-- The convention is to put the <style> elements below
     in res/values/styles.xml and <declare-styleable> in
     res/values/attrs.xml. -->
<resources>

    <!-- First declare a custom theme attribute that'll
         reference a style resource. -->
    <declare-styleable name="AppTheme">
        <attr name="myButtonStyle" format="reference" />
    </declare-styleable>

    <!-- Provide a style resource as the value for the
         theme attribute. As a side note, if you want to
         change the default button style, you can instead
         override the android:buttonStyle attribute. -->
    <style name="AppTheme" parent="android:Theme.Holo">
        <item name="myButtonStyle">@style/MyButton</item>
    </style>

    <!-- Define the custom button style itself. Make sure
         to inherit from an existing button style. -->
    <style name="MyButton" parent="android:Widget.Holo.Button">
        <item name="android:textColor">#f00</item>
    </style>

</resources>
public class MyActivity extends Activity {
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ...

        // Pass in the theme attribute that'll resolve to the
        // desired button style resource. The current theme
        // must have a value set for this attribute.
        Button myButton = new Button(this, null, R.attr.myButtonStyle);
        myButton.setText("Hello world");

        ViewGroup containerView = (ViewGroup) findViewById(R.id.container);
        containerView.addView(myButton);
    }
}
<manifest ...>
    ...
    <!-- Make sure your app (or individual activity) uses the
         theme with the custom attribute defined. -->
    <application android:theme="@style/AppTheme" ...>
        ...
    </application>
</manifest>

以上是关于xml AndroidManifest.xml中的主要内容,如果未能解决你的问题,请参考以下文章

xml AndroidManifest.xml中

xml AndroidManifest.xml中

xml AndroidManifest.xml中

如何解决ERROR.Failed to parse XML in AndroidManifest.xml in Flutter的问题?在Flutter中解析AndroidManifest.xml中的X

学习Android之-----------------------AndroidManifest.xml

在 Android Studio 的 AndroidManifest.xml 中添加权限?