作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我很想在 Android 应用程序的标题中实现两个对齐。根据我的要求,标题需要有一个左对齐的“名称”和一个右对齐的“版本号”。
到目前为止,我尝试做的是测试 AndroidManifest.xml 文件的应用程序标签的标签属性是否接受 html,但它似乎不接受 :(。另外一些其他类似的问题我来到知道可以使用自定义主题更改标题的样式。但这并没有回答我的问题:
"Can we have two different alignments (say left and right), or for that case two different themes, to the parts of the application name?"
P.S:下面附上了所需应用程序标题的屏幕截图。
最佳答案
您可以创建自定义标题栏..这是示例代码。
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.i_main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.i_title);
final TextView titleLeft = (TextView) findViewById(R.id.title_left);
final TextView titleRight = (TextView) findViewById(R.id.title_right);
titleLeft.setText("Checker");
titleRight.setText("Version 5.44");
}
i_title.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/title_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="app name" />
<TextView
android:id="@+id/title_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="app version" />
</RelativeLayout>
关于android - 是否可以对 Android 应用程序的应用程序名称进行两次对齐?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13228314/
概述 CentOS Stream 成立于 2019 年,是“RHEL 下一步的滚动预览”。Red Hat 首席技术官 Chris Wright 和 CentOS 社区经理 Rich Bowen 各
我有一个使用 Mesosphere DC/OS 编排选项进行配置的 Azure 容器服务 (ACS) 集群。我可以在 Marathon UI 中创建一个应用程序。 但是,当我通过 Marathon U
我是一名优秀的程序员,十分优秀!