You specify fractions in XML as so: <item name=”fraction” type=”fraction”>5%</item> <item name=”parent_fraction” type=”fraction”>2%p</item> Where 5% would be 0.05 when actually used. Then: // 0.05f getResources().getFraction(R.fraction.fraction, 1, 1); // 0.02f getResources().getFraction(R.fraction.parent_fraction, 1, 1); // 0.10f getResources().getFraction(R.fraction.fraction, 2, 1); // 0.10f getResources().getFraction(R.fraction.fraction, 2, 2); // 0.04f getResources().getFraction(R.fraction.parent_fraction, 1, 2); // 0.04f getResources().getFraction(R.fraction.parent_fraction, 2, 2); As you can … Read more