如何在android中改变屏幕方向时改变布局的位置?
我有一个按钮Relativelayout.
当手机是LANDSCAPE,Relativelayout它在底部.
当电话出现时,它会转到屏幕右侧PORTRAIT.
如下图所示.
我得到了屏幕的方向,但是如何设置Relativelayout从下到右的位置变化?

- - - - - - - - - - - - - - - - - 编辑 - - - - - - - - -------------
的代码xml在layout-land.
有两个button在top_buttonlayout1中,另外两个button是bottom_buttonlayout1.
的top_buttonlayout1是Relative-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 rtsp streaming audio"。
但最多的信息是client在 android 设备上接收和播放流媒体。
而我想要的是send live streaming audio from Android device.
问题
如何从 Android 设备通过 RTSP 发送实时流音频?
这个问题让我很困惑...
是否有任何信息或示例?
提前致谢 !!!
我正在尝试WiFi-Direct(WiFi-P2P)在Android中实现.我参考了示例代码samples\android-19\legacy\WiFiDirectDemo.
我安装WiFiDirectDemo.apk上phone-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) 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 get来json data解析它.
到目前为止它工作正常,它显示了数据UITableView.我有一个UITableCell在UITableView.并且单元格中还有三个UILabel-s,如下图所示.

我已经设置Identifier的TableViewCell,以"细胞"就像下面的图片.

我想设置"AAA" , "BBB" , "CCC"为UILebel-s中UITableViewCell,但在下面的代码,我找不到任何UILabel在UITableViewCell.
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文件?
如何找到和文本设置UILabel的UITableViewCell?
我错过了什么吗?
我正在开发使用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中以编程方式拍摄照片?
提前致谢.
我是Objective-C和IOS开发的新手.我正尝试用BLE开发App.
我按照DarkBlue和添加以下代码viewDidLoad在ViewController.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) 我正在开发Android中的BLE.Android可以通过发送数据到BLE设备Gatt.writeCharacteristic.
但是当我连续写入BLE设备的特性(1秒内5次)时,我会得到GATT_DISCONNECTED它null,getService并在我尝试时返回GetCharacteristic.
我在市场上看到了一些BLE LED产品.它在Android中使用颜色选择器,如下图所示:
当用户在颜色选择器上快速更改颜色时,BLE LED也会立即改变颜色.
如何像市场上的BLE LED产品一样在Android中为BLE写出快速稳定的特性?
我正在为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函数?
提前致谢.
这是我的代码的样子:
double test = (21757952*100)/63290718;
Log.i("TAH", "test = " +test);
Run Code Online (Sandbox Code Playgroud)
它显示"test = -33"
为什么价值错了?它溢出了吗?
android ×4
ios ×4
swift ×3
objective-c ×2
audio ×1
camera ×1
http ×1
ios7 ×1
iphone ×1
java ×1
orientation ×1
rtsp ×1
uitableview ×1
wifi-direct ×1