小编Mar*_*tin的帖子

如何在android中改变屏幕方向时改变布局的位置?

如何在android中改变屏幕方向时改变布局的位置?

我有一个按钮Relativelayout.

当手机是LANDSCAPE,Relativelayout它在底部.

当电话出现时,它会转到屏幕右侧PORTRAIT.

如下图所示.

我得到了屏幕的方向,但是如何设置Relativelayout从下到右的位置变化?

在此输入图像描述

- - - - - - - - - - - - - - - - - 编辑 - - - - - - - - -------------

的代码xmllayout-land.

有两个buttontop_buttonlayout1中,另外两个buttonbottom_buttonlayout1.

top_buttonlayout1Relative-2在画面,以及bottom_buttonlayout1是底部relativelayout.

我希望它改变为直,怎么办?

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


    <LinearLayout
        android:id="@+id/top_buttonlayout1"
        android:layout_width="fill_parent" …
Run Code Online (Sandbox Code Playgroud)

android orientation android-layout android-orientation

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

如何在 Android 设备上通过 RTSP 发送实时流音频?

我有搜索关键字:"android rtsp streaming audio"

但最多的信息是client在 android 设备上接收和播放流媒体。

而我想要的是send live streaming audio from Android device.

问题

如何从 Android 设备通过 RTSP 发送实时流音频?

这个问题让我很困惑...

是否有任何信息或示例?

提前致谢 !!!

audio android rtsp

5
推荐指数
0
解决办法
6271
查看次数

如何在Android中为WiFi-Direct(WiFi-P2P)获取对等设备的IP地址?

我正在尝试WiFi-Direct(WiFi-P2P)在Android中实现.我参考了示例代码samples\android-19\legacy\WiFiDirectDemo.

我安装WiFiDirectDemo.apkphone-A并运行它.在phone-B上转WiFi-Direct(WiFi-P2P)Android Setting.

phone-A连接到电话-B ,它显示出对以下信息phone-A.

在此输入图像描述

代码如下:

@Override
    public void onConnectionInfoAvailable(final WifiP2pInfo info) {
        Log.d(WifiP2P.TAG, "onConnectionInfoAvailable----------- " + info);
        if (progressDialog != null && progressDialog.isShowing()) {
            progressDialog.dismiss();
        }
        this.info = info;
        this.getView().setVisibility(View.VISIBLE);

        // The owner IP is now known.
        TextView view = (TextView) mContentView.findViewById(R.id.group_owner);
        view.setText(getResources().getString(R.string.group_owner_text)
                + ((info.isGroupOwner == true) ? getResources().getString(R.string.yes)
                        : getResources().getString(R.string.no)));

        // InetAddress from WifiP2pInfo struct.
        view = (TextView) mContentView.findViewById(R.id.device_info); …
Run Code Online (Sandbox Code Playgroud)

android wifi-direct

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

How to get the status code from HTTP Get in swift?

I have try the following code to implement HTTP Get in IOS Swift.

NSURLConnection.sendAsynchronousRequest(request, queue: queue, completionHandler: {(response: NSURLResponse!, data: NSData!,error: NSError!) -> Void in

            var jsonResult: NSDictionary = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: nil) as NSDictionary
            println("response = \(response)")
        })
Run Code Online (Sandbox Code Playgroud)

It success and show the following response:

response = <NSHTTPURLResponse: 0x155xxxxx> { URL: http://xxx.xx.xxx.xxx:38080/getid/user-wiced1 } 
{ status code: 200, headers {
    "Content-Length" = 111;
    "Content-Type" = "application/json; charset=UTF-8";
    Date = "Thu, 08 Jan 2015 07:31:21 GMT";
    Server = "spray-can/1.3.2-20140909";
} …
Run Code Online (Sandbox Code Playgroud)

http ios swift

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

如何在Swift中查找并设置UITabel UILabel的文本?

我用它Http getjson data解析它.

到目前为止它工作正常,它显示了数据UITableView.我有一个UITableCellUITableView.并且单元格中还有三个UILabel-s,如下图所示.

在此输入图像描述

我已经设置IdentifierTableViewCell,以"细胞"就像下面的图片. 在此输入图像描述

我想设置"AAA" , "BBB" , "CCC"UILebel-sUITableViewCell,但在下面的代码,我找不到任何UILabelUITableViewCell.

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell

        cell.

        return cell
    }
Run Code Online (Sandbox Code Playgroud)

我是否需要连接UILabel到Swift文件?

如何找到和文本设置UILabelUITableViewCell

我错过了什么吗?

uitableview ios swift

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

如何通过Swift编程自动拍照?

我正在开发使用iPhone相机的Swift.

我使用以下代码检查相机:

if UIImagePickerController.isSourceTypeAvailable(.Camera) {   
    let picker = UIImagePickerController()
        picker.delegate = self
        picker.sourceType = UIImagePickerControllerSourceType.Camera
        picker.allowsEditing = true  
        self.presentViewController(picker, animated: true)
    } else {
        print("can't find camera")
    }
}
Run Code Online (Sandbox Code Playgroud)

我使用以下代码打开相机.

presentViewController(imagePicker, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)

我参考了以下链接和电话takePicture(),但似乎没有工作.

但我总是需要通过点击快门按钮手动拍摄照片.是否可以在Swift中以编程方式拍摄照片?

提前致谢.

iphone camera ios swift

5
推荐指数
2
解决办法
8859
查看次数

如何解决Objective-C中的"NSInternalInconsistencyException"错误?

我是Objective-C和IOS开发的新手.我正尝试用BLE开发App.

我按照DarkBlue和添加以下代码viewDidLoadViewController.m

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.defaultBTServer = [BTServer defaultBTServer];
    self.defaultBTServer.delegate = (id)self;
    [self.defaultBTServer startScan];

}
Run Code Online (Sandbox Code Playgroud)

而BTServer就像下面的代码:

//
//  BTServer.m
//  DarkBlue
//
//  Created by chenee on 14-3-26.
//  Copyright (c) 2014? chenee. All rights reserved.
//

#import "BTServer.h"

@interface BTServer()


@end


@implementation BTServer{
    BOOL inited;
    CBCentralManager *myCenter;
    //state
    NSInteger scanState;
    NSInteger connectState;
    NSInteger serviceState;
    NSInteger characteristicState;
    NSInteger readState;


    eventBlock …
Run Code Online (Sandbox Code Playgroud)

objective-c bluetooth-lowenergy ios7

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

如何在Android中为BLE编写快速稳定的特性?

我正在开发Android中的BLE.Android可以通过发送数据到BLE设备Gatt.writeCharacteristic.

但是当我连续写入BLE设备的特性(1秒内5次)时,我会得到GATT_DISCONNECTEDnull,getService并在我尝试时返回GetCharacteristic.

我在市场上看到了一些BLE LED产品.它在Android中使用颜色选择器,如下图所示:

在此输入图像描述

当用户在颜色选择器上快速更改颜色时,BLE LED也会立即改变颜色.

如何像市场上的BLE LED产品一样在Android中为BLE写出快速稳定的特性?

android bluetooth-lowenergy

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

如何从Objective-C中获取UUID的特性?

我正在为Objective-C开发BLE.

我像下面的代码一样定义UUID:

    static NSString *const LEDStateCharacteristicUUID = @"ffffffff-7777-7uj7-a111-d631d00173f4";
Run Code Online (Sandbox Code Playgroud)

我想通过以下代码为BLE设备写特性,它需要通过3个参数:1.Data 2.Characteristic 3.type

CBCharacteristic *chara = ??? // how to set the characteristic via above UUID let it can pass to following function?

[peripheral writeValue:data forCharacteristic:chara type:CBCharacteristicWriteWithoutResponse];
Run Code Online (Sandbox Code Playgroud)

如何通过上面的UUID设置特性让它可以传递给writeCharacteristic函数?

提前致谢.

objective-c ios core-bluetooth bluetooth-lowenergy

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

为什么简单计算的值会在java中产生错误的结果?它溢出了吗?

这是我的代码的样子:

double test = (21757952*100)/63290718;
Log.i("TAH", "test = " +test);
Run Code Online (Sandbox Code Playgroud)

它显示"test = -33"

为什么价值错了?它溢出了吗?

java

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