天道酬勤,学无止境

android-titlebar

Gradient styles

In my Android application I've hidden the default title bar, introduced a TabView and added my own titlebar under that TabView's tabs. At the moment, I'm using the ?android:attr/windowTitleStyle style which makes my new titlebar look gray and gradient. It looks pretty good, but my screens are looking pretty grayscale. I'd like to spice things up a bit by making this titlebar a different color gradient. What am I looking at here? Creating my own image and using it? The ?android:attr/windowTitleStyle style seems to expand depending on the height of your custom titlebar; so I'm not sure it's

2021-07-12 07:39:38    分类:问答    android   gradient   titlebar   android-titlebar

android:set title bar in middle

I create the custom title using the style.I code some from http://labs.makemachine.net/2010/03/custom-android-window-title/ I have also set the icon in title bar using the setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,R.drawable.title_logo); can it is possible to set the title bar in middle?if possible then I want set using the custom style. EDIT: i have check code http://andmobidev.blogspot.com/2010/01/centering-title-of-window.html it work fine when there no icon in title bar but when set the icon i get the error java.lang.ClassCastException: android.widget.RelativeLayout i have no

2021-06-26 08:23:12    分类:问答    android   android-titlebar

Regarding removal of Activity Title bar in Android

i have already set the theme of my activity as android:theme = "@android:style/Theme.Dialog" but i also want to remove the title bar of the activity. so how to use android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" along with the dialog theme.

2021-06-15 03:12:39    分类:问答    android   coding-style   android-sdk-2.1   android-titlebar   android-theme

更改微调器下拉宽度(Change Spinner DropDown width)

问题 我需要将此零件尺寸调整为完整显示。 我怎样才能做到这一点? 我的适配器: String[] navigations = getResources().getStringArray(R.array.actionBar); ArrayAdapter<String> adapter = new ArrayAdapter<String>( getBaseContext(), R.layout.custom_spinner_title_bar, android.R.id.text1, navigations); adapter.setDropDownViewResource(R.layout.custom_spinner_title_bar); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actionBar.setListNavigationCallbacks(adapter, navigationListener); custom_spinner_title_bar.xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

2021-06-10 15:33:55    分类:技术分享    android   spinner   android-spinner   titlebar   android-titlebar

启动android应用程序时如何删除标题?(How to remove the title when launching android app?)

问题 我已经在 onCreate() 方法中删除了标题。 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final ActionBar actionBar = getActionBar(); actionBar.setHomeButtonEnabled(false); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayUseLogoEnabled(false); actionBar.setDisplayShowTitleEnabled(false); } 不显示标题。 但是在启动应用程序时仍然出现。 我可以用 this.requestWindowFeature(Window.FEATURE_NO_TITLE); 或放 android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 进入清单文件,因为我正在使用 actionBar。 如果我这样做,应用程序就会崩溃。 所以,我的问题是,有没有办法在应用程序启动时删除标题

2021-06-10 12:53:34    分类:技术分享    android   android-titlebar

Android Toolbar Title

Unable to change toolbar title I set title in manifeast.xml & also used setTitle("TITLE"); I set title as History & Reports but it display different title Notifications which is another activity title. I checked manifeast.xml but No change, Can anyone please help me from this. Here is my code public class Nav_HistoryAndReports extends AppCompatActivity { private Toolbar toolbar; private TabLayout tabLayout; private ViewPager viewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle("History & Reports"); setContentView(R.layout.nav

2021-06-02 12:58:55    分类:问答    android   android-manifest   android-appbarlayout   android-titlebar

How to remove the title when launching android app?

I already remove the title in onCreate() method. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final ActionBar actionBar = getActionBar(); actionBar.setHomeButtonEnabled(false); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayUseLogoEnabled(false); actionBar.setDisplayShowTitleEnabled(false); } The title is not displayed. But still appears when launching the app. And I can use this.requestWindowFeature(Window.FEATURE_NO_TITLE); or put android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

2021-05-25 06:38:54    分类:问答    android   android-titlebar

Change Spinner DropDown width

I need resize this part size to full display. How can i do this? My adapter: String[] navigations = getResources().getStringArray(R.array.actionBar); ArrayAdapter<String> adapter = new ArrayAdapter<String>( getBaseContext(), R.layout.custom_spinner_title_bar, android.R.id.text1, navigations); adapter.setDropDownViewResource(R.layout.custom_spinner_title_bar); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actionBar.setListNavigationCallbacks(adapter, navigationListener); custom_spinner_title_bar.xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http:/

2021-05-18 07:09:28    分类:问答    android   spinner   android-spinner   titlebar   android-titlebar

getSupportActionBar()。setTitle()vs工具栏.setTitle()(getSupportActionBar().setTitle() vs toolbar.setTitle())

问题 我知道有两种方法可以在Android Activity设置标题。 假设我已经有以下代码... @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_activity); ... Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar); setSupportActionBar(toolbar); ...我可以用... getSupportActionBar().setTitle("My title"); ...或这个... toolbar.setTitle("My title"); ...设定我的头衔。 我的问题是,哪种更好的做法? 回答1 如果调用setSupportActionBar(Toolbar) ,则操作栏负责处理标题,因此您需要调用getSupportActionBar().setTitle("My Title"); 设置自定义标题。 还要检查此链接,其中toolbar.setTitle("My title"); 可能会导致如下问题:-在android应用中,Toolbar.setTitle方法无效

2021-05-08 20:09:23    分类:技术分享    android   android-actionbar   android-toolbar   android-titlebar

将自定义标题与FEATURE_PROGRESS结合(Combine custom title with FEATURE_PROGRESS)

问题 在我的onCreate()中,设置进度条如下: getWindow().requestFeature(Window.FEATURE_PROGRESS); getWindow().setFeatureInt( Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON); 现在,希望对标题栏进行一些增强,我想更改其背景颜色。 第一步是检查是否支持FEATURE_CUSTOM_TITLE : final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); if ( customTitleSupported ) { Log.i(TAG, "CUSTOM TITLE SUPPORTED!") } 但是,一旦我调用了requestWindowFeature(Window.FEATURE_CUSTOM_TITLE)我就会得到: AndroidRuntimeException: You cannot combine custom titles with other title features (我是否在设置FEATURE_PROGRESS之前或之后调用此函数都没有关系) 任何想法如何解决这个问题? 另外

2021-04-20 20:49:40    分类:技术分享    android   android-layout   android-titlebar