Java 为自定义选项卡外观创建渐变
我想创建如下所示的选项卡Java 为自定义选项卡外观创建渐变,java,android,xml,tabs,gradient,Java,Android,Xml,Tabs,Gradient,我想创建如下所示的选项卡 <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:bottomLeftRadius="7dp" android:topRightRadius="7dp"/> <solid android:color="#000" /> <stroke
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:bottomLeftRadius="7dp"
android:topRightRadius="7dp"/>
<solid
android:color="#000" />
<stroke
android:width="2dp"
android:color="#fff"/>
但我最终得到了这样的效果
我想在活动选项卡顶部创建一个简单的渐变(在本例中是搜索最近的),颜色为灰色或接近白色
下面是所选的代码
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#000"
android:centerColor="#FFF"
android:endColor="#000"
android:type="linear"/>
</shape>
我怎样才能达到这个效果呢?我还想知道如何在两侧实现圆角。当前,当我选择活动选项卡时,圆角仅应用于右角。下面是我如何做的代码
到现在为止,我觉得是这样的
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:bottomLeftRadius="7dp"
android:topRightRadius="7dp"/>
<solid
android:color="#000" />
<stroke
android:width="2dp"
android:color="#fff"/>
我想这样编码,当我点击左键时,左键应该被激活,右键必须被激活
感谢您的时间:)在
中,您需要使用android:angle=“90”
。对于角点,您可以创建一些形状并单击进行更改