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. ListView Scroll in the touch mode ?

Hi all , i'm rearranging items in the list by dragging the item. I'm
in the touch mode and want to scroll view couple of items  then i'm on
the last/first visiblePosition. Since i'm in the touch mode
setSelection is useless. How i can scroll  a list in the touch mode.
For drag i'm using onTouchEvent , onLayout to change background for
the current item + some stuff in adapter to make a swap.
--~--~---------~--~----~------------~-------~--~----~

2. Google provide updated internal apps for cupcake?

Since HTC Magic is running an variant of the cupcake build and has all
the internal apps like Market, Google Email, and etc, this means these
apps have been updated to run on the new 1.5 kernel.  Can't Google
provide these apk files so we can install them onto our developer
phones??
--~--~---------~--~----~------------~-------~--~----~

3. Call vs Voice plan App Idea! SOMEONE MAKE IT :D:D PLEASE

4. ******New Model Android Phone for sale******

5. Blog: A Brief History of the Android App Store Race

6. Google: We need to know how paid app transactions will work!

7. Blog: A Brief History of the Android App Store Race