小编dra*_*ula的帖子

仅在第一个实例上拆分字符串 - java

我想用'='charecter分割一个字符串.但是我希望它只能在第一个实例中拆分.我怎样才能做到这一点 ?这是'_'char的JavaScript示例,但它不适用于 仅在指定字符的第一个实例上拆分字符串

示例:

apple=fruit table price=5
Run Code Online (Sandbox Code Playgroud)

当我尝试String.split('='); 它给

[apple],[fruit table price],[5]
Run Code Online (Sandbox Code Playgroud)

但是我需要

[apple],[fruit table price=5]
Run Code Online (Sandbox Code Playgroud)

谢谢

java string split

124
推荐指数
3
解决办法
10万
查看次数

android布局利润百分比

我想按百分比设置边距.我在线性布局中有4个图像视图,并希望设置默认的左,右,上,下边距,每个屏幕尺寸保持相同的百分比.

可能吗 ?

这是一个我想要的演示.. 在此输入图像描述

这就是我尝试过但不起作用的东西

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:weightSum="10" >

        <Thumbnail
            android:id="@+id/thumb1"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="4" />

        <Thumbnail
            android:id="@+id/thumb2"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="4" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:weightSum="10" >

         <Thumbnail
             android:id="@+id/thumb3"
             android:layout_width="0dp"
             android:layout_height="match_parent"
             android:layout_weight="4" >
         </Thumbnail>

        <Thumbnail
            android:id="@+id/thumb4"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="4" />

    </LinearLayout>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助

android android-linearlayout

28
推荐指数
3
解决办法
4万
查看次数

android - 提交后折叠searchview

我在我的应用程序中使用searchview(没有操作栏).如何在查询文本提交后折叠searchview?

我有这些听众;

        @Override
        public boolean onQueryTextSubmit(String query) {

            InputMethodManager imm = (InputMethodManager)thisFr.getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(globalSearch.getWindowToken(), 0);

            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            // TODO Auto-generated method stub
            return false;
        }
Run Code Online (Sandbox Code Playgroud)

我不使用ActionBar所以我没有像collapseActionView()这样的函数.

等待帮助

谢谢

android collapse searchview

10
推荐指数
2
解决办法
1万
查看次数

在Android上玩HLS(比较替代方案)

我想讨论关于Android的HLS,想要学习价格,如何购买它们,以及你对这些玩家的体验.

Vitamio - http://www.vitamio.org/en/

Standart许可证是免费的,但它不支持自适应流媒体.是否有人测试过高级版或如何购买高级版

NexStreaming - http://www.nexstreaming.com/ 我发了邮件但没有回复.有人测试过吗?

Kaltura - http://www.kaltura.org/ 它看起来像一个开源替代品,但示例代码对我没用

还有其他的替代方案吗?你在Android上玩HLS的经历是什么?

谢谢..

android http-live-streaming kaltura vitamio

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

android - 线性布局bringToFront()

我的线性布局中有4个按钮,我需要将第一个按钮带到前面.

正常的顺序是

    Button 1 | Button 2 | Button 3 | Button 4
Run Code Online (Sandbox Code Playgroud)

但是当我调用button1.bringToFront()函数时,button1将会结束

    Button 2 | Button 3 | Button 4 | Button 1
Run Code Online (Sandbox Code Playgroud)

我怎么解决这个问题.相对布局不会导致此问题,但我必须使用LinearLayout,因为按钮将垂直排序,我在某些条件下删除按钮.

谢谢

android android-linearlayout

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

android服务在应用程序被杀死时自动重启

我正在开发一个应用程序,通过接收器与我的服务进行通信.

服务代码

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(LOCATION_UPDATE);
    mBroadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            receiverWorks(intent);
        }
    };
  this.registerReceiver(mBroadcastReceiver, intentFilter);
  return START_STICKY;
    }
Run Code Online (Sandbox Code Playgroud)

服务的清单声明

    <service
        android:name="com.test.IService"
        android:enabled="true"
        android:label="IService"
        android:process=":iservice" >
    </service>
Run Code Online (Sandbox Code Playgroud)

问题是它在应用程序(我使用此服务的应用程序)被杀死后重新启动.我该如何防止这种情况?试图删除android:进程但没有任何变化.

等你帮忙.

谢谢

java service android

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

android - 将按钮重叠在另一个按钮上

我怎么能重叠Button在另一个内部RelativeLayout

谢谢.

这是我尝试过的.谢谢

   <RelativeLayout
        android:id="@+id/category"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_gravity="center_vertical|center_horizontal|center"
        android:gravity="center"
        android:orientation="horizontal" >

        <ImageView
            android:id="@+id/btn1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@id/btn2"
            android:layout_centerHorizontal="true"
            android:layout_centerInParent="true"
            android:layout_centerVertical="true"
            android:src="@drawable/btn1" />

        <ImageView
            android:id="@+id/btn2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/btn2" />

    </RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

android button overlap relativelayout

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