Views with the same dip width number have different widths in appearance on device

by Michael Smith » Thu, 27 Jan 2011 12:32:04 GMT


Sponsored Links
 I have a horizontal linear layout separated with lines like the
following:

    <View
      android:background="@drawable/gradient_white2"
      android:layout_height="fill_parent"
      android:layout_width="1dip"
    />

In the layout editor, the lines have the same width, however, on the
device they do not - the second line in the layout below is slightly
wider than the other two. I'm wondering if there is an explanation for
this or a way around it.

Here is what the layout looks like:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=" http://schemas.android.com/apk/res/ 
android"
  android:background="@drawable/customized_title_bar_button"
  android:layout_height="fill_parent"
  android:layout_width="fill_parent"
  android:orientation="horizontal"
  <ImageButton
    android:background="@drawable/customized_title_bar_button"
    android:id="@+id/home"
    android:layout_height="fill_parent"
    android:layout_width="wrap_content"
    android:src="@drawable/header_logo_small"
  />
  <LinearLayout
    android:background="@drawable/gradient_shape_blue"
    android:gravity="right|center"
    android:layout_weight="1"
    android:layout_height="fill_parent"
    android:layout_width="wrap_content"
    android:orientation="horizontal"
  >
    <View
      android:background="@drawable/gradient_white2"
      android:layout_height="fill_parent"
      android:layout_width="1dip"
    />
    <ImageButton
      android:background="@drawable/customized_title_bar_button"
      android:id="@+id/map"
      android:layout_height="fill_parent"
      android:layout_width="wrap_content"
      android:src="@drawable/globe_icon"
    />
    <View
      android:background="@drawable/gradient_white2"
      android:layout_height="fill_parent"
      android:layout_width="1dip"
    />
    <ImageButton
      android:background="@drawable/customized_title_bar_button"
      android:id="@+id/saved"
      android:layout_height="fill_parent"
      android:layout_width="wrap_content"
      android:src="@drawable/saved_icon"
    />
    <View
      android:background="@drawable/gradient_white2"
      android:layout_height="fill_parent"
      android:layout_width="1dip"
    />
    <ImageButton
      android:background="@drawable/customized_title_bar_button"
      android:id="@+id/search"
      android:layout_height="fill_parent"
      android:layout_width="wrap_content"
      android:src="@drawable/search_icon"
    />
  </LinearLayout>
</LinearLayout>

Thanks,

Mike

-- 



Views with the same dip width number have different widths in appearance on device

by Michael Smith » Thu, 27 Jan 2011 12:32:04 GMT


 I have a horizontal linear layout separated with lines like the following:

 *   <View*
*      android:background="@drawable/gradient_white2"*
*      android:layout_height="fill_parent"*
*      android:layout_width="1dip"*
*    />*

In the layout editor, the lines have the same width, however, on the device
they do not - the second line in the layout below is slightly wider than the
other two. I'm wondering if there is an explanation for this or a way around
it.

Here is what the layout looks like:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=" http://schemas.android.com/apk/res/android" ;
  android:background="@drawable/customized_title_bar_button"
  android:layout_height="fill_parent"
  android:layout_width="fill_parent"
  android:orientation="horizontal"
  <ImageButton
    android:background="@drawable/customized_title_bar_button"
    android:id="@+id/home"
    android:layout_height="fill_parent"
    android:layout_width="wrap_content"
    android:src="@drawable/header_logo_small"
  />
  <LinearLayout
    android:background="@drawable/gradient_shape_blue"
    android:gravity="right|center"
    android:layout_weight="1"
    android:layout_height="fill_parent"
    android:layout_width="wrap_content"
    android:orientation="horizontal"
  >
*    <View*
*      android:background="@drawable/gradient_white2"*
*      android:layout_height="fill_parent"*
*      android:layout_width="1dip"*
*    />*
    <ImageButton
      android:background="@drawable/customized_title_bar_button"
      android:id="@+id/map"
      android:layout_height="fill_parent"
      android:layout_width="wrap_content"
      android:src="@drawable/globe_icon"
    />
 *   <View*
*      android:background="@drawable/gradient_white2"*
*      android:layout_height="fill_parent"*
*      android:layout_width="1dip"*
*    />*
    <ImageButton
      android:background="@drawable/customized_title_bar_button"
      android:id="@+id/saved"
      android:layout_height="fill_parent"
      android:layout_width="wrap_content"
      android:src="@drawable/saved_icon"
    />
 *   <View*
*      android:background="@drawable/gradient_white2"*
*      android:layout_height="fill_parent"*
*      android:layout_width="1dip"*
*    />*
    <ImageButton
      android:background="@drawable/customized_title_bar_button"
      android:id="@+id/search"
      android:layout_height="fill_parent"
      android:layout_width="wrap_content"
      android:src="@drawable/search_icon"
    />
  </LinearLayout>
</LinearLayout>

Thanks,

Mike

-- 


Sponsored Links


Other Threads

1. Howto pass pointer to char parameter to kernel via copy_to_user()

Hi,

Thanks Abhinav and Danke. I found the issue:

Both of you are right, I wrongly allocate the memory. I never try to
pass any string before (so pity) ... I am trapped in the equality of
sizeof(int) and sizeof(*int). Different for pointer to char, the
sizeof() must not be used, instead using length of string as
parameter.

Regards,
DWI






> website: 

2. HTC tattoo List separators and menu separator lines are not visible

Amit,

Did you define <supports-screens....> in the manifest? If not, you need to add it for proper scaling, besides the usual <uses-sdk..> -- Kostya 21.07.2010 11:36, Amit :
Hi All, I am testing my android application on HTC Tattoo device. I have written some custom list views with my own adapters. The problem i am facing is that i can see my list properly in the emulator but when i run the same application on HTC tatto, the divider line between individual list item is not visible. What may be the problem and how i can overcome from it. In addition, i am also not able to see separator between menu items as well on the device. Thanks in advance. Amit
-- Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com --

3. HTC tattoo List separators and menu separator lines are not visible

4. Added Interface of is not resolving at runtime

5. URL links are not opened in HTML viewer

6. Sinyal XL yg menyebalkan

7. Some time URL links are not opened in HTML viewer