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. UnknowHost when connected in WIFI

Hi,

I send files to ftp server in my application.
Internet permission is set :  <uses-permission
android:name="android.permission.INTERNET"/>

It works quite fine when connected with 3G/3G+.
Sometimes, not very often, I get a "SocketException no route to host"
or "unknow host" exception when trying to connect.

When I'm connected with WIFI, it works sometimes and it's very fast,
but the same error occurs very often, and when it has occured I must
restart my wifi to be able to connect again, even with webbrowser.

I use apache commons FTPClient this way :

ftpClient.connect(server, 21);
ftpClient.login(user, password);
ftpClient.changeWorkingDirectory(directory);
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
BufferedInputStream buffIn = new BufferedInputStream(new
FileInputStream(file));
ftpClient.enterLocalPassiveMode();
ftpClient.storeFile(file.getName(), buffIn);
buffIn.close();
ftpClient.logout();
ftpClient.disconnect();

errors look like this :

06-12 11:17:32.887: ERROR/DictoSyl(3146): No route to host
06-12 11:17:32.887: ERROR/DictoSyl(3146): java.net.SocketException: No
route to host
06-12 11:17:32.887: ERROR/DictoSyl(3146):     at
org.apache.harmony.luni.platform.OSNetworkSystem.connectSocketImpl
(Native Method)
06-12 11:17:32.887: ERROR/DictoSyl(3146):     at
org.apache.harmony.luni.platform.OSNetworkSystem.connect
(OSNetworkSystem.java:125)
06-12 11:17:32.887: ERROR/DictoSyl(3146):     at
org.apache.harmony.luni.net.PlainSocketImpl.connect
(PlainSocketImpl.java:227)
06-12 11:17:32.887: ERROR/DictoSyl(3146):     at
org.apache.harmony.luni.net.PlainSocketImpl.connect
(PlainSocketImpl.java:199)
06-12 11:17:32.887: ERROR/DictoSyl(3146):     at
java.net.Socket.startupSocket(Socket.java:734)
06-12 11:17:32.887: ERROR/DictoSyl(3146):     at java.net.Socket.<init>
(Socket.java:157)
06-12 11:17:32.887: ERROR/DictoSyl(3146):     at
org.apache.commons.net.DefaultSocketFactory.createSocket
(DefaultSocketFactory.java:53)
06-12 11:17:32.887: ERROR/DictoSyl(3146):     at
org.apache.commons.net.SocketClient.connect(SocketClient.java:162)
06-12 11:17:32.887: ERROR/DictoSyl(3146):     at
com.sylpheo.core.android.ftp.FtpManager.start(FtpManager.java:43)

or:

ERROR :
java.net.UnknownHostException: ftpsylpheo.sylpheo.com -
ftpsylpheo.sylpheo.com
at java.net.InetAddress.lookupHostByName(InetAddress.java:522)
at java.net.InetAddress.getByName(InetAddress.java:336)
at java.net.Socket.<init>(Socket.java:155)
at org.apache.commons.net.DefaultSocketFactory.createSocket
(DefaultSocketFactory.java:53)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:162)
at com.sylpheo.core.android.ftp.FtpManager.start(FtpManager.java:43)


it looks like having forgotten something that makes connection down
after several uses of my ftp program, but what ? and why does this
work quite well (but not always) with 3G/EDGE connection ?

Thanks in advance for your reply.
Pierre
--~--~---------~--~----~------------~-------~--~----~

2. Kernel build error on Mac OS

Hi

I'm trying to build Android kernel on Mac OS and I've got the
following error:

estherchiu:kernel Season$ make ARCH=arm CROSS_COMPILE=../prebuilt/
darwin-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-
  CHK     include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
  CHK     include/linux/utsrelease.h
  CALL    scripts/checksyscalls.sh
sed: 4: "/^\#define/ { s/[^_]*__ ...": bad flag in substitute command:
'}'
  HOSTCC  scripts/mod/mk_elfconfig
scripts/mod/mk_elfconfig.c:4:17: error: elf.h: No such file or
directory
scripts/mod/mk_elfconfig.c: In function ain
scripts/mod/mk_elfconfig.c:9: error: I_NIDENTundeclared (first use
in this function)
scripts/mod/mk_elfconfig.c:9: error: (Each undeclared identifier is
reported only once
scripts/mod/mk_elfconfig.c:9: error: for each function it appears in.)
scripts/mod/mk_elfconfig.c:19: error: LFMAGundeclared (first use
in this function)
scripts/mod/mk_elfconfig.c:19: error: ELFMAGundeclared (first use
in this function)
scripts/mod/mk_elfconfig.c:23: error: I_CLASSundeclared (first use
in this function)
scripts/mod/mk_elfconfig.c:24: error: LFCLASS32undeclared (first
use in this function)
scripts/mod/mk_elfconfig.c:27: error: LFCLASS64undeclared (first
use in this function)
scripts/mod/mk_elfconfig.c:33: error: I_DATAundeclared (first use
in this function)
scripts/mod/mk_elfconfig.c:34: error: LFDATA2LSBundeclared (first
use in this function)
scripts/mod/mk_elfconfig.c:37: error: LFDATA2MSBundeclared (first
use in this function)
scripts/mod/mk_elfconfig.c:9: warning: unused variable imake[2]: *** [scripts/mod/mk_elfconfig] Error 1
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2

Any way to fix this problem?

Thanks,
Season

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: 

3. TextView always loses focus after orientation change

4. Google Checkout Payment Decline Won't Let Customer Repurchase App

5. a receiver for outgoing sms and email?

6. apps after factory reset

7. Google Checkout Payment Decline Won't Let Customer Repurchase App