This file contains 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
try { | |
ViewConfiguration config = ViewConfiguration.get(this); | |
Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); | |
if(menuKeyField != null) { | |
menuKeyField.setAccessible(true); | |
menuKeyField.setBoolean(config, false); | |
} | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} |
This file contains 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
<item | |
android:id="@+id/menu_overflow" | |
android:title="Overflow" | |
android:icon="@android:drawable/ic_menu_more" | |
android:orderInCategory="1" | |
app:showAsAction="always"> | |
<menu> | |
<item android:id="@+id/item1" | |
android:icon="@drawable/icon1" | |
android:title="title1" |
This file contains 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
AndroidManifest.xml: | |
android:theme="@style/MyAppTheme" | |
Styles.xml: | |
<style name="MyAppTheme" parent="@style/Theme.AppCompat.Light"> | |
<item name="actionDropDownStyle">@style/DropDownNav.Example</item> | |
</style> | |
<style name="DropDownNav.Example" parent="@style/Widget.AppCompat.Light.Spinner.DropDown.ActionBar"> | |
<item name="android:background">@android:color/transparent</item> |
This file contains 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
//call in onCreate() | |
private void moveDrawerToTop() { | |
DrawerLayout drawer = (DrawerLayout) layoutInflater.inflate(R.layout.left_drawer, null); // "null" is important. | |
// HACK: "steal" the first child of left_drawer view | |
ViewGroup decor = (ViewGroup) getWindow().getDecorView(); | |
View child = decor.getChildAt(0); | |
decor.removeView(child); | |
LinearLayout container = (LinearLayout) drawer.findViewById(R.id.drawer_content); // This is the container we defined just now. | |
container.addView(child, 0); |
This file contains 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
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:background="@android:color/transparent" | |
android:padding="5dp" | |
android:id="@+id/status" | |
android:orientation="horizontal" | |
android:visibility="visible" | |
android:layout_width="fill_parent" | |
android:layout_height="wrap_content"> | |
<TableRow |
This file contains 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
package com.nix.betavest.activities; | |
/** | |
* Created by vlevytskyy on 18.03.2015. | |
*/ | |
import android.annotation.SuppressLint; | |
import android.content.Context; | |
import android.support.v4.view.ViewPager; | |
import android.util.AttributeSet; |
This file contains 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
double d1 = 1.234567; | |
double d2 = 2; | |
NumberFormat nf = new DecimalFormat("##.###"); | |
System.out.println(nf.format(d1)); | |
System.out.println(nf.format(d2)); |
This file contains 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
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_dropdown_item) { | |
@Override | |
public View getView(int position, View convertView, ViewGroup parent) { | |
View v = super.getView(position, convertView, parent); | |
if (position == getCount()) { | |
((TextView)v.findViewById(android.R.id.text1)).setText(""); | |
((TextView)v.findViewById(android.R.id.text1)).setHint(getItem(getCount())); //"Hint to be displayed" | |
} |
This file contains 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
import android.content.Context; | |
import android.text.Layout.Alignment; | |
import android.text.StaticLayout; | |
import android.text.TextPaint; | |
import android.util.AttributeSet; | |
import android.util.TypedValue; | |
import android.widget.TextView; | |
/** | |
* Text view that auto adjusts text size to fit within the view. |
OlderNewer