大佬教程收集整理的这篇文章主要介绍了android – 在圆形磨损装置的角落中对齐元素,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
数字时钟将超出界限.
我在google IO 2014上看过android的文档,有些人表示,有一行代码,以便正确对齐对象.
我希望数字时钟位于左上角,但不在屏幕外.
有没有人有建议?
<RelativeLayout xmlns:android="http://scheR_749_11845@as.android.com/apk/res/android" xmlns:tools="http://scheR_749_11845@as.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MyActivity" tools:deviceids="wear_round"> <DigitalClock android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/text" android:textSize="20sp"/> </RelativeLayout>@H_197_13@编辑:
<?xml version="1.0" encoding="utf-8"?> <android.support.wearable.view.BoxInsetLayout xmlns:android="http://scheR_749_11845@as.android.com/apk/res/android" xmlns:app="http://scheR_749_11845@as.android.com/apk/res-auto" android:layout_height="match_parent" android:layout_width="match_parent"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1234567890" app:layout_Box="top"/> </android.support.wearable.view.BoxInsetLayout>@H_197_13@正如您所看到的,我尝试使用BoxInsetLayout,但仍然是输出如下:
虽然我用过
app:layout_Box="top"@H_197_13@TextView超出了屏幕的界限.我有什么监督?
<?xml version="1.0" encoding="utf-8"?> <android.support.wearable.view.BoxInsetLayout xmlns:android="http://scheR_749_11845@as.android.com/apk/res/android" xmlns:app="http://scheR_749_11845@as.android.com/apk/res-auto" android:layout_height="match_parent" android:layout_width="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:BACkground="@color/grey" app:layout_Box="top"> [...] </LinearLayout> </android.support.wearable.view.BoxInsetLayout>@H_197_13@您可以将app:layout_Box设置为以下值:left | top | right | bottom或all.你可以在你的情况下使用所有内容,然后所有内容都将保留在每一方的框内.当app在方形手表上运行时,将忽略此布局的效果.
编辑:
我刚刚测试了你发布的代码为“不起作用”:
<?xml version="1.0" encoding="utf-8"?> <android.support.wearable.view.BoxInsetLayout xmlns:android="http://scheR_749_11845@as.android.com/apk/res/android" xmlns:app="http://scheR_749_11845@as.android.com/apk/res-auto" android:layout_height="match_parent" android:layout_width="match_parent"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1234567890" app:layout_Box="all"/> </android.support.wearable.view.BoxInsetLayout>@H_197_13@有活动:
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceStatE) { super.onCreate(savedInstanceStatE); setContentView(R.layout.activity_main); } }@H_197_13@我已经告诉过你要使用layout_Box中的all值,但即使是top也可以使用:
app:layout_Box =“top”:(仅从顶部偏移)
app:layout_Box =“all”:(从任何一侧偏移)
以上是大佬教程为你收集整理的android – 在圆形磨损装置的角落中对齐元素全部内容,希望文章能够帮你解决android – 在圆形磨损装置的角落中对齐元素所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。