仅在视图(1/4)部分设置背景颜色(Android)(Set Background color in only (1/4)th portion of a View (Android))
是否可以在Android中仅为(1/4)部分设置背景颜色? 我有一个用例,我需要选择一个视图并在分割后将其着色,我看过开发人员文档,但我无法找到一种方法来做同样的事情。
编辑:我需要把它变成“| | | |”之类的东西 我需要动态地做。
Is it possible to set background color for only (1/4)th portion of a View in Android? I have a use case where I need to select a view and color it after dividing it in portions, Ive looked at developer docs but I am unable to find a way to do the same.
Edit: I need to make it banded something like "| | | |" and I need to do it dynamically.
最满意答案
它对你有用
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#FFFFFF" android:endColor="#00000000" android:angle="45"/> </shape> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/gradient" > </LinearLayout>it is useful for you
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#FFFFFF" android:endColor="#00000000" android:angle="45"/> </shape> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/gradient" > </LinearLayout>更多推荐
发布评论