top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Android: LayoutParams constructor overload with size in dip?

+2 votes

In Android SDK there isn't an overload of a constructor of ViewGroup (and subclasses) with possibilities to specify the width and height in DP (or DIP) instead of in pixel. Why? Actually we have:

ViewGroup.LayoutParams(int width, int height)

Could be a good idea to have:

ViewGroup.LayoutParams(int dpWidth, int dpHeight, int ComplexUnitType.Dip) 
where ComplexUnitType could be an enum with units of measurement (for e.g) 
posted Jun 30, 2015 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+5 votes

I am using a linear layout and I want to position my EditText in center and linear layout full width.
This is my code,

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android=""
xmlns:tools="" android:layout_width="fill_parent" android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity" android:background="#eeeeee">


        android:hint="Enter the Name of Event"
        android:layout_alignParentStart="true" />

0 votes

According to CDD document, it is stated below"Device implementations MUST have at least 340MB of memory available to the kernel and userspace. The 340MB MUST be in addition to any memory dedicated to hardware components such as radio, video, and so on that is not under the kernel's control."

MY understanding:
340 MB is required for both user and kernel space. 340 MB is for hardware components , So, in total minimum 680 MB (Please correct me if my understanding is wrong ?)

But, if i look at mobiles that are available in the market, they are not compliance with the requirement. (HTC ONE V , has 512 MB of RAM, but still runs android 4.0.3 , in which the requirement is 680MB.)

Considering above, how the OEM vendor passes compatibility test?

+2 votes

I wonder if it is possible to get the logcat output along with timestamp?
If so, how can i get it?

+3 votes

It appears that in master ( now supports BCP-47, including script names. Does this mean that with the next Android version ("L"?) I will be able to create and use locales like "bs_Latn_BA" or "bs_Cyrl_BA"?

I am currently running KitKat and I don't see a system property that will persist the script part of the locale name. We have just:

I have tried to set the language property to include the script part (setprop persist.sys.language bs_Cyrl), and the value gets stored, but the script part is apparently ignored. If I set the language to bs_Cyrl and the country to BA, I get my dates/times/numbers etc. formatted with Latin values, not Cyrillic (bs_Latn_BA).

Am I correct in concluding that KitKat does not support locale names that include script parts, but that L will (might)? And that it will presumably have a new persistent property that will store the script?