Sim*_*mer 11 android android-framelayout
FrameLayout具有属性android:foreground,android:foregroundGravity和android:measureAllChildren.我已经尝试过这些属性,但无法弄清楚它们如何影响布局的外观或它们的工作方式.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="@android:color/holo_blue_dark"
android:foregroundGravity="center"
android:measureAllChildren="true"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.framelayoutdemo.MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/btn_dialog" />
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
我用谷歌搜索,但无法找到这些属性的帮助.请给我一个链接,我可以参考或帮助我举个例子.谢谢
May*_*aul 14
android:foreground指出你Framelayout需要在其所有孩子之上绘制的前景
android:foregroundGravity如果该资产是可绘制的,则指向该资产的严重性.这意味着如果你正在使用
android:foreground="@android:drawable/bottom_bar"
Run Code Online (Sandbox Code Playgroud)
然后你的drawable被绘制在它的所有孩子的顶部,它位于the的中心 Framelayout
android:measureAllChildren :确定测量时是测量所有儿童还是仅测量VISIBLE或INVISIBLE测量状态.默认为false.这意味着,如果将其设置为false,那么GONE当Framelayout测量阶段到来时,不会考虑该状态中的所有元素.
希望这能回答你的问题.
| 归档时间: |
|
| 查看次数: |
18431 次 |
| 最近记录: |