Dra*_*ško 2 android android-layout android-framelayout
我有以下布局(这里提供了更简单的设计):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_main">
<FrameLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hey, badge!"
android:layout_margin="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AAAAA"
android:layout_margin="10dp"
android:textSize="12sp"
android:background="#ff00ff"
android:padding="10dp"
android:layout_gravity="top|end"
/>
</FrameLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我希望将TextView设置为文本"AAAA"以充当Button的徽章,即将其放置在其右上角的按钮上,但事实并非如此.
相反,当我在带有Lollipop的HTC One M7或带有Lollipop的Genymotion Nexus 6上尝试此代码时,屏幕看起来像这样:
当我使用KitKat在Genymotion Nexus 5上尝试相同的代码时,一切看起来都符合预期,即第一个视图(按钮)显示在徽章(textview)下面
有没有人知道这里有什么问题?
谢谢,Deveti
| 归档时间: |
|
| 查看次数: |
2241 次 |
| 最近记录: |