例如,
TextView feedback = (TextView) findViewById(R.id.feedback);
feedback.setText("good job!");
feedback.setTextColor(0xff77dd77);
将文本颜色设置为#77dd77,我在此网站上找到了该颜色: http://www.colorhexa.com/77dd77
提前致谢!
答案 0 :(得分:2)
根据setTextColor(int)
的文件:
0xAARRGGBB形式的颜色值。
其中AA - 是alpha通道, [lastImageAsset
requestContentEditingInputWithOptions:options
completionHandler:^(PHContentEditingInput *contentEditingInput, NSDictionary *info) {
NSURL *imageURL = contentEditingInput.fullSizeImageURL;
CIImage *inputImage = [CIImage imageWithContentsOfURL:imageURL];
inputImage = [inputImage imageByApplyingOrientation:contentEditingInput.fullSizeImageOrientation];
EAGLContext *glContext = [[EAGLContext alloc]initWithAPI:kEAGLRenderingAPIOpenGLES2];
CIContext *context = [CIContext contextWithEAGLContext:glContext];
CGImageRef imageRef = [context createCGImage:inputImage fromRect:inputImage.extent];
UIImage *image = [UIImage imageWithCGImage:imageRef scale:1.0 orientation:UIImageOrientationUp];
NSData *imageData = UIImageJPEGRepresentation(image, 1.0);
PHContentEditingOutput *output = [[PHContentEditingOutput alloc]initWithContentEditingInput:contentEditingInput];
PHAdjustmentData *adjustmentData = [[PHAdjustmentData alloc]initWithFormatIdentifier:@"Some Identifier" formatVersion:@"1.0" data:[@"Changed Something" dataUsingEncoding:NSUTF8StringEncoding]];
[output setAdjustmentData:adjustmentData];
[imageData writeToURL:output.renderedContentURL atomically:YES];
[[PHPhotoLibrary sharedPhotoLibrary]performChanges:^{
PHAssetChangeRequest *changeRequest = [PHAssetChangeRequest changeRequestForAsset:lastImageAsset];
changeRequest.contentEditingOutput = output;
} completionHandler:^(BOOL success, NSError * _Nullable error) {
NSLog(@"%@, %i", error, success);
}];
}];
代表十六进制表示。所以0x
的{{1}}部分是RGB
但是如果你尝试传递0xff77dd77
它实际上是77DD77
,颜色将完全不可见。