toolbar

How to add bottom shadow to tab layout or Toolbar in android

坚强是说给别人听的谎言 提交于 2020-02-10 13:37:46
问题 Hi i need add shadow under my tab layout (like in skype). My activity xml: <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.Toolbar xmlns:local="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" android:background="@color/splashGreenTop" local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"

How to add bottom shadow to tab layout or Toolbar in android

廉价感情. 提交于 2020-02-10 13:37:28
问题 Hi i need add shadow under my tab layout (like in skype). My activity xml: <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.Toolbar xmlns:local="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" android:background="@color/splashGreenTop" local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"

最新解决Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar); setSupportActionBar(toolbar);报错

非 Y 不嫁゛ 提交于 2020-02-06 19:41:36
根据这个Toolbar来看,默认导入的类为: import android . widget . Toolbar ; 记得以前改为 java import android.support.v7.widget.Toolbar; 就可以了,但是现在这种方案已经行不通了 最新解决方案如下: 在Activity中引入的是: import androidx . appcompat . widget . Toolbar ; activity_main.xml如下: 在activity_main.xml中也不使用 < android . support . v7 . widget . Toolbar > 而是使用: <androidx.appcompat.widget.Toolbar < FrameLayout xmlns : android = "http://schemas.android.com/apk/res/android" android : layout_width = "match_parent" android : layout_height = "match_parent" > < androidx . appcompat . widget . Toolbar android : id = "@+id/toolbar" android : layout_width =

Android Navigation Icon - Profile picture instead of hamburger icon

自闭症网瘾萝莉.ら 提交于 2020-02-06 08:19:46
问题 I'm trying to find how to change the hamburger icon that opens the navigation drawer to some custom image that can be loaded with Picasso or something like that. Just like in the image above, where Twitter managed to put my profile picture replacing the hamburger icon they had before. I couldn't find anything like this here and I don't have a clue about how to do it. If anyone got a sample or some guidance on how to do it, I would really appreciate it. EDIT Some of my Activity's code:

Android Navigation Icon - Profile picture instead of hamburger icon

[亡魂溺海] 提交于 2020-02-06 08:19:23
问题 I'm trying to find how to change the hamburger icon that opens the navigation drawer to some custom image that can be loaded with Picasso or something like that. Just like in the image above, where Twitter managed to put my profile picture replacing the hamburger icon they had before. I couldn't find anything like this here and I don't have a clue about how to do it. If anyone got a sample or some guidance on how to do it, I would really appreciate it. EDIT Some of my Activity's code:

Andriod Studio学习笔记第五天

社会主义新天地 提交于 2020-02-06 04:12:26
一、getWindowManager().getDefaultDisplay().getHeight() 和getWindowManager().getDefaultDisplay().getWidth()被移除The method getHeight() is deprecated,替代方法。 1.Activity中 DisplayMetrics dm = new DisplayMetrics ( ) ; getWindowManager ( ) . getDefaultDisplay ( ) . getMetrics ( dm ) ; SCREEN_WIDTH = dm . widthPixels ; SCREEN_HEIGHT = dm . heightPixels ; 2.Adaptor和Fragment中 (getWindowManager()方法是在类Activity中的) DisplayMetrics dm = getResources ( ) . getDisplayMetrics ( ) ; layout . setLayoutParams ( new LinearLayout . LayoutParams ( dm2 . widthPixels , dm2 . heightPixels ) ) ; 二、动态调用Fragment 1.Activity < ?

AppCompat Toolbar: Change Overflow Icon Color in ActionMode

自古美人都是妖i 提交于 2020-01-30 14:31:33
问题 With the AppCompat Toolbar, I want to be able to change the color of the overflow menu icon on ActionMode change. For example, the overflow icon will be white in normal Toolbar mode. And will turn black on ActionMode. So far, I have managed to change the background of the action mode as well as the title text. But I have yet to find a way to change the overflow menu icon color. I know that there's an answer available: Change ActionMode Overflow icon I tried the first solution and I wasn't

Android之沉浸式状态栏的实现

拥有回忆 提交于 2020-01-26 15:37:31
沉浸式状态栏确切的说应该叫做透明状态栏。一般情况下,状态栏的底色都为黑色,而沉浸式状态栏则是把状态栏设置为透明或者半透明。 为什么要使用沉浸式状态栏 沉浸式状态栏是从android Kitkat(Android 4.4)开始出现的,它可以被设置成与APP顶部相同的颜色,这就使得切换APP时,整个界面就好似切换到了与APP相同的风格样式一样。在内容展示上会显得更加美观。 实现方式 需要注意的是, 因为沉浸式状态栏是在Android4.4的时候出现的,所以只有4.4及以后的版本才能使用。 实现沉浸式状态栏的方式有几种,最简单的方式就是使用系统提供的方式进行实现。 系统提供的方法 在需要实现沉浸式状态栏的Activity的布局中添加以下参数 android:fitsSystemWindows="true" android:clipToPadding="true" 代码中对当前系统进行判断,符合要求(即系统是4.4或以上的版本)则设置成透明状态栏 private void initState() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { //透明状态栏 getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); /

Android 广播(Android 10)

拥有回忆 提交于 2020-01-25 19:56:27
代码实现 AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.myapplication"> <uses-permission android:name="android.permission.BROADCAST_STICKY" /> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar"> <intent-filter> <action

Converting ToolBar to ToolStrip control and MouseHover not working

*爱你&永不变心* 提交于 2020-01-25 10:06:25
问题 I have a large winform application which we working to modify the appearance. I am replacing System.Windows.Forms.Toolbar to System.Windows.Forms.ToolStrip control. I use a custom renderer to change dropdown arrow color. with default renderer i get mouse hover effects in toolstrip but with my custom rendering it dont seem to work. Here's my code. Tool strip initialization:I removed unnecessary code for reading comfort this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.imageList1 =