This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//source: https://developer.android.com/training/system-ui/status | |
View decorView = getWindow().getDecorView(); | |
// Hide the status bar. | |
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; | |
decorView.setSystemUiVisibility(uiOptions); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//link: http://developer.alexanderklimov.ru/android/theory/scales.php | |
// | |
//examples | |
//********************** | |
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent" | |
android:orientation="vertical" > |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String text = "some text"; | |
shareText(text); | |
private void shareText(String text) { | |
Intent shareIntent = new Intent(Intent.ACTION_SEND); | |
shareIntent.setType("text/plain"); | |
shareIntent.putExtra(Intent.EXTRA_TEXT, text); | |
startActivity(Intent.createChooser(shareIntent, "Share text")); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StatusBarUtils { | |
public static void makeTransparentStatusBar(Activity activity) { | |
if (Build.VERSION.SDK_INT >= 19 && Build.VERSION.SDK_INT < 21) { | |
setWindowFlag(activity, true); | |
} | |
if (Build.VERSION.SDK_INT >= 19) { | |
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); | |
} | |
//make fully Android Transparent Status bar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Many thanks to this author https://github.com/chroaster/MSLPBug | |
//I use adnroidx, but you can use any support libraries | |
//Notice, it issue use deprecated methods, but I don't see problem with performence of app. | |
//********************** | |
package com.example.mslpfixdemo; | |
import android.annotation.TargetApi; | |
import android.app.AlertDialog; | |
import android.content.Context; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dialog dialog = new Dialog(this); | |
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); | |
dialog.setCancelable(false); | |
dialog.setContentView(R.layout.progress_layout); | |
dialog.show(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void setMargins (View view, int left, int top, int right, int bottom) { | |
if (view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) { | |
ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) view.getLayoutParams(); | |
p.setMargins(left, top, right, bottom); | |
view.requestLayout(); | |
} | |
} | |
//How to call it — Utils.setMargin(imageView, 0, 20, 0, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) collapsToolbar.getLayoutParams(); | |
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED); | |
collapsToolbar.setLayoutParams(params); | |
//clear scroll flags — params.setScrollFlags(0); |
OlderNewer