我正在尝试做一个包含文本(公司名称)+ R(注册符号)的简单buttom,但我还需要R将是文本的上标,如下所示: http://www.geofonica.com/graphics/gf-logo.gif
先谢谢。
答案 0 :(得分:2)
用于上标注册商标符号的html代码,类似于Google®
$ gcloud beta app deploy ./app.yaml --no-promote --version=v3-0-2 --verbosity=debug
DEBUG: Running [gcloud.beta.app.deploy] with arguments: [--no-promote: "false", --verbosity: "debug", --version: "v3-0-2", DEPLOYABLES:1: "[u'./app.yaml']"]
INFO: Refreshing access_token
DEBUG: API endpoint: [https://appengine.googleapis.com/], API version: [v1beta]
Services to deploy:
descriptor: [/Users/yed/dev/xxx/appname/beapplication/app.yaml]
source: [/Users/yed/dev/xxx/appname/beapplication]
target project: [appname]
target service: [py3]
target version: [v3-0-2]
target url: [https://v3-0-2-dot-py3-dot-appname.appspot.com]
(add --promote if you also want to make this service available from
[https://py3-dot-appname.appspot.com])
Do you want to continue (Y/n)? y
DEBUG: No bucket specified, retrieving default bucket.
DEBUG: Using bucket [gs://staging.appname.appspot.com].
Beginning deployment of service [py3]...
INFO: Using ignore file at [/Users/yed/dev/xxx/appname/beapplication/.gcloudignore].
DEBUG: Skipping file [pyproject.toml]
...
INFO: Incremental upload skipped 98.62% of data
...
File upload done.
INFO: Manifest: [{u'application/_config/dfp.py': {...list of files...}}]
DEBUG: Converted YAML to JSON: "{
"automaticScaling": {
"standardSchedulerSettings": {
"maxInstances": 5,
"minInstances": 1
}
},
"entrypoint": {
"shell": ""
},
"envVariables": {
"REDIS_HOST": "xxx",
},
"handlers": [
{
"script": {
"scriptPath": "auto"
},
"securityLevel": "SECURE_ALWAYS",
"urlRegex": "/.*"
}
],
"inboundServices": [
"INBOUND_SERVICE_WARMUP"
],
"instanceClass": "F4",
"runtime": "python38",
"vpcAccessConnector": {
"name": "projects/appname/locations/europe-west2/connectors/xxx"
}
}"
DEBUG: Operation [apps/appname/operations/xxx] not complete. Waiting to retry.
Updating service [py3]...⠏DEBUG: Operation [apps/appname/operations/xxx] complete. Result: {
"response": {
"runtimeChannel": "default",
"versionUrl": "https://v3-0-2-dot-py3-dot-appname.appspot.com",
"name": "apps/appname/services/py3/versions/v3-0-2",
"servingStatus": "SERVING",
"createTime": "2020-01-09T02:08:35Z",
"@type": "type.googleapis.com/google.appengine.v1beta.Version",
"inboundServices": [
"INBOUND_SERVICE_WARMUP"
],
"threadsafe": true,
"instanceClass": "F4",
"env": "standard",
"automaticScaling": {
"standardSchedulerSettings": {
"minInstances": 1,
"maxInstances": 5
}
},
"runtime": "python38",
"id": "v3-0-2",
"network": {}
},
"done": true,
"name": "apps/appname/operations/xxx",
"metadata": {
"target": "apps/appname/services/py3/versions/v3-0-2",
"method": "google.appengine.v1beta.Versions.CreateVersion",
"user": "xxx",
"insertTime": "2020-01-09T02:07:30.085Z",
"endTime": "2020-01-09T02:08:37.860Z",
"@type": "type.googleapis.com/google.appengine.v1beta.OperationMetadataV1Beta"
}
}
Updating service [py3]...done.
INFO: Not stopping previous version because new version was not promoted.
Deployed service [py3] to [https://v3-0-2-dot-py3-dot-appname.appspot.com]
You can stream logs from the command line by running:
$ gcloud app logs tail -s py3
To view your application in the web browser run:
$ gcloud app browse -s py3
INFO: Display format: "none"
并在您的文本视图中
<string name=company_name">Company name<sup>®</sup></string>
然后使用方法Html.fromHtml()
答案 1 :(得分:0)
使用html代码“注册商标标志”,&amp;#174
显示如下内容: 公司名称®
实现这一目标的两种方法:
1)添加到您的strings.xml
文件
<string name=company_name">Company name ®</string>
并将该字符串加载到您的布局
<TextView
android:id="@+id/txt_company"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/company_name"/>
2)使用方法Html.fromHtml()
((TextView)findViewById(R.id.text)).setText(Html.fromHtml("Company name ®"));
答案 2 :(得分:0)
使用Html.fromHtml
,你可以在TextView,Button等中显示html(至少是一个子集)......
可以在android button text and html
找到一个很好的例子对于已注册的符号,您可以将其编码为html实体®®
要在上标中显示符号,您可以使用html标记<sup></sup>
答案 3 :(得分:0)
如果您确实拥有代码,我认为您可以按照以下方式执行:
((TextView)findViewById(R.id.text)).setText(Html.fromHtml("<sup>®</sup>"));
否则,我认为假设一个上标R可能是可以接受的。
((TextView)findViewById(R.id.text)).setText(Html.fromHtml("<sup>R</sup>"));
希望它有所帮助。
来源:http://developer.android.com/guide/faq/commontasks.html#selectingtext