我想显示标签宽度水平滚动条.我尝试像这样实现如何设置标签视图滚动?
但是标签没有填满宽度.
怎么解决?
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
</TabWidget>
</LinearLayout>
</HorizontalScrollView>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</FrameLayout>
</LinearLayout>
<ProgressBar
android:id="@+id/destinationProgressBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</TabHost>
Run Code Online (Sandbox Code Playgroud)

我想使用LIKE和反斜杠来搜索一些名称。问题是Postgres将反斜杠理解为LIKE子句中的转义字符。我试图打开,standard_conforming_strings但没有帮助。
SELECT h.software_id
,h.software_name
FROM software h
WHERE software_name LIKE '%\%';
Run Code Online (Sandbox Code Playgroud)
该查询未显示任何内容,而我的软件名称为“ \”。
我听说有人提到过prepared statement。我使用Hibernate进行上述查询。
<persistence-unit name="policyPersistence" transaction-type="JTA">
<jta-data-source>java:jboss/datasources/MyApp</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="validate" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy"/>
</properties>
</persistence-unit>
Run Code Online (Sandbox Code Playgroud)
JPA
query.setParameter(1, "%" + searchCriteria.getSoftwareName() + "%");
Run Code Online (Sandbox Code Playgroud)
但是Postgres无法正确转义反斜杠。
如何解决?
我有使用IntelliJ创建的GWT-Maven项目。我可以构建并运行它,但是浏览器在主页上显示一个奇怪的错误。如何解决?
我试图创建一个新项目并导入现有代码,但这无济于事。
项目下载:GwtStudy
我刚刚阅读了Guava并查看了它的源代码,但不知道如何构建它来使用它.我使用"mvn package"构建了jar文件,但它产生了Guava GWT的错误.
[ERROR] Failed to execute goal on project guava-gwt: Could not resolve dependenc
ies for project com.google.guava:guava-gwt:jar:latest: Failure to find com.googl
e.guava:guava:jar:sources:latest in http://repo1.maven.org/maven2 was cached in
the local repository, resolution will not be reattempted until the update interv
al of central has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable …Run Code Online (Sandbox Code Playgroud) 我想获得Shift-jis和Utf-8的strlen(),然后比较它们.字符串可以混合"ああ12345678sdfdszzz".我试图使用strlen但它会产生不同的结果.mb_strlen也没有帮助,因为这是一个混合字符串.
例如:
??12345678 >> strlen() = 24 chars
???????????????? >> strlen() = 48 chars
?????????????????? >> strlen() = 54 chars
Run Code Online (Sandbox Code Playgroud)
似乎没有规则.那么计算strlen并在多语言中比较它们的最佳方法是什么?
我想从我的Google Picasa帐户中获取相册列表.我试过这个指南.问题是它成功验证但没有返回任何相册(请参阅下面的代码).我还是可以发一张新专辑.
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import com.google.gdata.client.photos.PicasawebService;
import com.google.gdata.data.PlainTextConstruct;
import com.google.gdata.data.photos.AlbumEntry;
import com.google.gdata.data.photos.UserFeed;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;
public class Test {
public static void main(String[] args) {
String username = "myusername";
String password = "mypassword";
PicasawebService service = new PicasawebService("myapp");
try {
// Get list of albums. (AUTHENTICATION SUCCESSFUL BUT NO ALBUM RETURNED)
service.setUserCredentials(username, password);
URL url = new URL("https://picasaweb.google.com/data/feed/api/user/" + username + "?kind=album");
UserFeed feed = service.getFeed(url, UserFeed.class);
List<AlbumEntry> albums …Run Code Online (Sandbox Code Playgroud) 我有这个代码。它只是读取一个GIF文件,使用背景重绘该文件并输出到新的GIF文件。
问题是结果文件变得奇怪。我不知道为什么它质量会变差。JPG文件上不会发生此问题。如何解决?
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class ImageTest {
public static void main(String[] args) {
f();
}
private static final String EXTENSION = "gif";
private static final String FILENAME = "pinkHeart";
private static final String PATH = "/Users/hieugioi/Downloads/";
public static void f() {
File file = new File(PATH + FILENAME + "." + EXTENSION);
try {
final BufferedImage originalImage = ImageIO.read(file);
int imageType = getImageType(originalImage);
final BufferedImage buff = …Run Code Online (Sandbox Code Playgroud) 我希望以这种格式(下图)从Wiki获取内容页面,然后在WebView中显示它.这意味着内容包括文本和链接.

我试过这个,但输出似乎很乱. http://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&titles=Albert_Einstein&format=xmlfm
我有表A(innoDB)和表B(MyISAM).当我将外键从A添加到B.它报告:
ERROR 1005: Can't create table (errno: 150)
Run Code Online (Sandbox Code Playgroud)
为什么?
我希望像ViewPager一样通过转换来启动活动.我的意思是活动A将活动B从一侧推到另一侧.我读了这个并试图实现转换,但它与ViewPager不相似.
slide_up1.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
>
<translate
android:fromXDelta="0%p" android:toXDelta="0%p"
android:fromYDelta="100%p" android:toYDelta="0%p"
android:duration="1000" android:startOffset="500"/>
</set>
Run Code Online (Sandbox Code Playgroud)
slide_up2.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
>
<translate
android:fromXDelta="0%p" android:toXDelta="0%p"
android:fromYDelta="100%p" android:toYDelta="0%p"
android:duration="1000" android:startOffset="0"/>
</set>
Run Code Online (Sandbox Code Playgroud)
叫它.
overridePendingTransition(R.animator.slide_up1, R.animator.slide_up2);
Run Code Online (Sandbox Code Playgroud)
编辑:
解决我的情况.
slide_up1.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"
>
<translate android:fromXDelta="0%" android:toXDelta="0%"
android:fromYDelta="100%" android:toYDelta="0%"
android:duration="1000"/>
</set>
Run Code Online (Sandbox Code Playgroud)
slide_up2.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"
>
<translate
android:fromXDelta="0%" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="-100%"
android:duration="1000" />
</set>
Run Code Online (Sandbox Code Playgroud) android android-animation android-viewpager android-activity