Android的地方一个TextView在应用程序标题 [英] android place a textview over application title

查看:103
本文介绍了Android的地方一个TextView在应用程序标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能放置在应用程序标题栏的文本框?像X code,可以放置一个文本框的任何地方我猜使用绝对定位...

Is it possible to place a textbox over the application title bar? like in xcode, it is possible to place a textbox anywhere I guess using absolute positioning...

这样做的目的是把一个小的版本指示符应用程序标题栏的右上角。

The aim is to put a small version indicator on the top right corner of the application title bar.

感谢

推荐答案

请尝试以下之一。

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

        setContentView(R.layout.main);

        if ( customTitleSupported ) {
            getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.mytitle);
        }

        final TextView myTitleText = (TextView) findViewById(R.id.myTitle);
        if ( myTitleText != null ) {
            myTitleText.setText("MY TITLE");
        }


    }

这篇关于Android的地方一个TextView在应用程序标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆