小编use*_*131的帖子

使用正则表达式删除不需要的逗号

我正在创建一个应用程序,我在其中生成了这样的字符串:

 hihibjj,,,,,,,ghjjjj, , ,kartik.isworking@gmail.com,,,,karan.adep@gmail.com, android-developer-support@google.com, prerna.mungekar@hamarisuraksha.com
Run Code Online (Sandbox Code Playgroud)

我想要的是删除不需要的逗号,只应存在单个逗号分隔值.

我试过的代码

for (int i = 0; i < temp.length; i++) {
  for (int j = 0; j < emailSeperated.size(); j++) {
    if (temp[i].trim().equals(emailSeperated.get(j).trim())) {
      strEmailValue = strEmailValue.replace(temp[i], "").trim();
      Log.e("strEmail trimmed value", strEmailValue);
    } else if (temp[i].trim().equals(emailSeperated.get(j).trim())) {
      strEmailValue = strEmailValue.replaceAll(temp[i] + ",", "").trim();
    }
  }
} 
Run Code Online (Sandbox Code Playgroud)

java regex

4
推荐指数
1
解决办法
134
查看次数

困惑于v4和v13支持库

我正在使用min sdk verrsion = 15创建一个新的应用程序,所以我不想使用v4支持库.现在我的应用程序中我想使用scrolable标签,因此我需要查看pager.Now在我的xml中当我使用的东西像这样我得到错误

XMl代码

<android.support.v13.view.ViewPager
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android" /> 
Run Code Online (Sandbox Code Playgroud)

但是这个代码适用于v4支持库.

  1. 现在为什么我不能使用v13.view.pager ????
  2. 如果我使用v4.view.pager它将与其他片段重合,因为我没有使用v4.support.fragments

android android-fragments android-support-library

3
推荐指数
1
解决办法
4273
查看次数

在键盘上方显示视图

我正在制作一个我希望在键盘顶部显示线性布局的应用程序。当用户关闭键盘时,线性布局也应该消失。我想要这样的东西

在此处输入图片说明

布局我想要的

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1" >

        <RelativeLayout
            android:id="@+id/root"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical" >

                <ImageView
                    android:id="@+id/iv_Img1"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:scaleType="fitXY" />

                <ImageView
                    android:id="@+id/iv_Img2"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:scaleType="fitXY" />
            </LinearLayout>
        </RelativeLayout>

        <ImageView
            android:id="@+id/iv_Edit"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:padding="5dp"
            android:scaleType="center"
            android:src="@drawable/cam" />
    </RelativeLayout>

    <LinearLayout
        android:id="@+id/llEditOptions"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dp"
        android:layout_marginTop="5dp"
        android:layout_weight="0"
        android:visibility="gone" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true" >

            <ImageView
                android:id="@+id/iv_background"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_marginRight="50dp"
                android:layout_toLeftOf="@+id/iv_font"
                android:scaleType="center"
                android:src="@drawable/save_1" />

            <ImageView
                android:id="@+id/iv_font"
                android:layout_width="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

keyboard android android-custom-view

1
推荐指数
1
解决办法
4927
查看次数