我在更新背景以使用9补丁图像时遇到此问题.使用不同尺寸的相同图像在不同的屏幕上布局很好,但是当我将图像更改为9个补丁时,它会神秘地打破整个布局.
之前的布局如下所示:
原始布局http://onik.org/android/layoutOk.png.
当更改为9补丁时:
9-Patch图像http://onik.org/android/layoutError.png.
XML文件保持不变,只是改变了PNG文件.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg">
<TextView
android:text="@string/title"
android:id="@+id/login_title"
android:layout_width="fill_parent"
android:layout_height="40px"
android:textSize="30px">
</TextView>
<View
android:id="@+id/login_underline"
android:layout_width="wrap_content"
android:layout_height="2px"
android:background="#aaaaaa">
</View>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:stretchColumns="1"
android:gravity="center"
android:paddingLeft="10px"
android:paddingRight="10px">
<TableRow>
<TextView
android:id="@+id/login_usernameLabel"
android:text="@string/login_usernameLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="5px">
</TextView>
<EditText
android:text=""
android:id="@+id/login_username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:lines="1"
android:nextFocusDown="@+id/login_password">
</EditText>
</TableRow>
<TableRow>
<TextView
android:id="@+id/login_passwordLabel"
android:text="@string/login_passwordLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<EditText
android:text=""
android:id="@+id/login_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:nextFocusDown="@+id/login_login"
android:inputType="textPassword">
</EditText>
</TableRow>
<TableRow android:gravity="right">
<Button
android:text="@string/login_login"
android:id="@+id/login_login"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</Button> …Run Code Online (Sandbox Code Playgroud) 我一直在测试PHP套接字监听,并遇到了上述问题.我的测试监听器工作正常,但如果客户端在没有告诉服务器的情况下断开连接,则脚本会进入无限循环,直到新客户端连接为止.问题似乎在线,$ready = socket_select($read, $write = NULL, $except = NULL, $tv_sec = NULL);因为它应该停止等待连接在这里,而是它跳过等待并直接循环.
任何指针将不胜感激.
码:
#!/usr/bin/php -q
<?php
$debug = true;
function e($str) {
global $debug;
if($debug) { echo($str . "\n"); }
}
e("Starting...");
error_reporting(1);
ini_set('display_errors', '1');
e("Creating master socket...");
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$max_clients = 10;
e("Setting socket options...");
socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1);
e("Binding socket...");
socket_bind($socket, "192.168.1.38", 20000);
e("Listening...");
socket_listen($socket, $max_clients);
$clients = array('0' => array('socket' => $socket));
while(TRUE) {
e("Beginning of WHILE");
$read[0] = $socket;
for($i=1; …Run Code Online (Sandbox Code Playgroud) 我有一个完全在Eclipse中工作的项目,但是在用ant编译之后,为了使用Proguard来混淆代码,整个项目就崩溃了.
该项目包含一个包,包含两个主要活动和4个辅助类来处理数据库等.使用ant之后,活动工作正常,但Eclipse无法找到帮助程序类,也无法构建.即使我显式导入类,我得到的错误是
The import com.ts.routeTracking.DataHelper cannot be resolved在进一步提到类时得到错误DataHelper cannot be resolved to a type.
如何让Eclipse和ant一起工作?