Sun*_*hou 2 xml android android-xml android-view
在Android Studio中,我看到了一个<View />节点,它具有Widget的所有属性.我很好奇,这个节点是什么,我怎么能用呢?
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/material_cyan_200"
/>
Run Code Online (Sandbox Code Playgroud)
让我按照您的示例说明,您有一个视图标记
<View
android:id="@+id/myview"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/material_cyan_200"
/>
Run Code Online (Sandbox Code Playgroud)
这将绘制一条水平线的颜色grey,如果你需要做它invisible或其他一些动作,你可以在.java文件中做到,如在
View v=findViewById(R.id.myview);
v.setVisible(View.GONE); //will remove View from your UI
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13039 次 |
| 最近记录: |