Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to reset the title bar using a custom Layout

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article focuses on "how to use custom Layout to reset the title bar", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let the editor take you to learn "how to use custom Layout to reset the title bar"!

The default title bar of Android UI is defined by android:label and displayed in the upper left corner of the screen. Android allows Activity to customize the title bar and reset it using a custom Layout, such as a Windows Mobile-style title bar.

App- > Activity- > Custom Title redefine the Activity title bar as the left and right text boxes, and the Layout definition R.layout.custom_title_1 is as follows:

(the following xml contains two text boxes, one left and one right.

In addition to using the ContentView set by setContentView, there is also a Windows class object corresponding to each Activity. The Windows class object is used to control the title bar, which can be customized or not displayed. )

Windows defines some Feature, which allows developers to make some customization: the Feature ID corresponding to the custom title bar is Window.FEATURE_CUSTOM_TITLE.

RequestWindowFeature (Window.FEATURE_CUSTOM_TITLE); setContentView (R.layout.custom_title); getWindow (). SetFeatureInt (Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title_1); now that you have a better understanding of "how to reset the title block using custom Layout", you might as well do it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report