我有一个带有"ñ"字符的字符串,我遇到了一些问题.我需要将此String编码为UTF-8编码.我通过这种方式尝试过,但它不起作用:
byte ptext[] = myString.getBytes();
String value = new String(ptext, "UTF-8");
Run Code Online (Sandbox Code Playgroud)
如何将该字符串编码为utf-8?
我在使用EditTextAndroid 2.3时遇到问题.
我有一个已EditText定义的android:imeOptions="actionDone"属性但是当我通过虚拟键盘写入时,返回键没有检测到actionDone它并且它引入了一个返回行.
在Android 2.2中工作正常.
<EditText android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:imeOptions="actionDone" />
Run Code Online (Sandbox Code Playgroud) 我想将UTF-8编码设置为MultipartEntity对象或StringBody对象.有什么办法吗?我知道如何设置Charset而不是编码.
谢谢.
我掩盖了这样的图像:
UIView *maskImage; maskImage = [[UIView alloc] init];
maskImage.backgroundColor = UIColorFromRGB(FTRMaskColor);
maskImage.frame = newFrame;
CALayer *theLayer = [CALayer layer];
theLayer.contents = (id)[[UIImage imageNamed:@"image.png"] CGImage];
theLayer.frame = newFrame;
maskImage.layer.mask = theLayer;
Run Code Online (Sandbox Code Playgroud)
它工作正常但主要的问题是如果我想旋转我的Ipad,视图的旋转动画或图层(我不是很确定)不起作用.它旋转没有动画.你能帮忙吗?
我正在尝试将表情符号放在EditText中.我已经设法做到了它工作正常,但当我尝试使用软键盘从EditText删除这些表情符号时我遇到了问题.单击删除按钮,我无法执行此操作.当我插入一个新的ImageSpan时,我为它替换了imageId但是当我尝试删除de图标时,我必须删除所有imageId字符才能删除图像.
String fileName = "emoticon1.png";
Drawable d = new BitmapDrawable(getResources(), fileName);
String imageId = "[" + fileName + "]";
int cursorPosition = content.getSelectionStart();
int end = cursorPosition + imageId.length();
content.getText().insert(cursorPosition, imageId);
SpannableStringBuilder ss = new SpannableStringBuilder(content.getText());
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BASELINE);
ss.setSpan(span, cursorPosition, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
content.setText(ss, TextView.BufferType.SPANNABLE);
content.setSelection(end);
Run Code Online (Sandbox Code Playgroud)
我需要通过单击删除按钮来删除表情符号.请问你能帮帮我吗?
谢谢!
当我与我的网络服务器进行https连接时,我有一个SSLProtocolException.我在Android 2.3 Gingebread中只有这个例外; 相同的代码在所有其他Android版本中都能正常运行.这个Android版有什么问题吗?
我还向Google发布了一个错误报告:http://code.google.com/p/android/issues/detail?id = 16121&solpec = ID%20Type%20Status%20Owner%20Summary%20Stars
我附上了例外:
WARN/System.err(6218):javax.net.ssl.SSLProtocolException:读取错误:ssl = 0x3c97e8:SSL库失败,通常是协议错误WARN/System.err(6218):at org.apache.harmony.xnet .provider.jsse.NativeCrypto.SSL_read(本机方法)WARN/System.err(6218):at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl $ SSLInputStream.read(OpenSSLSocketImpl.java:788)WARN/System.错误(6218):at org.apache.harmony.luni.internal.net.www.protocol.http.FixedLengthInputStream.read(FixedLengthInputStream.java:44)WARN/System.err(6218):at java.io.BufferedInputStream. read(BufferedInputStream.java:319)WARN/System.err(6218):at android.os.Handler.dispatchMessage(Handler.java:99)WARN/System.err(6218):at android.os.Looper.loop( Looper.java:123)WARN/System.err(6218):在android.os.HandlerThread.run(HandlerThread.java:60)
我有一个horizontalScrollView,我需要在加载视图时自动滚动以动画结束.我已经实现了这个方法:
final HorizontalScrollView strip = (HorizontalScrollView) contentView.
findViewById(R.id.horizontalScrollView1);
strip.postDelayed(new Runnable() {
public void run() {
strip.fullScroll(HorizontalScrollView.FOCUS_RIGHT);
}
}, 1000L);
Run Code Online (Sandbox Code Playgroud)
它运行正常,但是,主要问题是滚动的动画太快,我需要实现较慢的滚动.你知道吗?
我需要用动画执行javascript方法scrollTo(x,y).我不能'使用jQuery来做到这一点.
我正在使用ACTION_SEND的Intent,我需要分享不同的文本.我需要发送Gmail文本,我需要发送其他文本的twitter.取决于应用程序.在应用程序发送共享文本之前,我可以获取用户选择的应用程序吗?
我需要在主页按钮上添加一个正确的填充ActionBar,我需要在选中它时更改其背景颜色.我可以使用我的标签执行这些操作,我添加了这些标签,实现了一种新风格,但我无法更改主页按钮的样式.有什么办法吗?
这是我实施的主题的来源:
<!-- style for the tabs -->
<style name="ActionBarTabStyle" parent="@android:style/Widget.Holo.Light.Tab">
<item name="android:background">@drawable/button_post</item>
<item name="android:paddingLeft">7dp</item>
<item name="android:paddingRight">7dp</item>
<item name="android:paddingBottom">10dp</item>
<item name="android:paddingTop">10dp</item>
</style>
<style name="ActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@color/button_post_default</item>
</style>
<style name="ActionButtonStyle" parent="@android:style/Widget.Holo.Light.ActionButton.Overflow">
<item name="android:background">@drawable/button_post</item>
</style>
<!-- Honeycomb theme -->
<style name="Theme.Honeycomb" parent="@android:style/Theme.Holo.Light">
<item name="android:windowNoTitle">false</item>
<item name="android:actionBarTabStyle">@style/ActionBarTabStyle</item>
<item name="android:actionBarStyle">@style/ActionBarStyle</item>
<item name="android:selectableItemBackground">@drawable/button_post</item>
<item name="android:actionOverflowButtonStyle">@style/ActionButtonStyle</item>
</style>
Run Code Online (Sandbox Code Playgroud) android ×7
java ×2
android-ui ×1
animation ×1
calayer ×1
galaxy-nexus ×1
ios ×1
iphone ×1
javascript ×1
objective-c ×1
scrollto ×1
ssl ×1
utf-8 ×1