我想像这样设置SeekBar:
但我的SeekBar看起来像这样:
这意味着它超过了两个小太阳"
这是我的代码:
<SeekBar
android:id="@+id/seekBar"
android:layout_span="2"
android:layout_width="fill_parent"
android:progressDrawable="@drawable/background_custom"
android:paddingTop="1dp"
android:paddingBottom="1dp"
android:thumb="@drawable/thumb_custom"
android:minHeight="20dp"
android:maxHeight="40dp"
android:layout_height="45dp"
android:layout_centerVertical="true"
android:max="100"
android:progress="100"
android:paddingLeft="1dp"
android:paddingRight="1dp"
android:background="@drawable/my_back_ground"
/>
background_custom的Xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background"
>
<shape>
<size
android:height="50dp"
android:width="50dp" />
<corners android:radius="50dp" />
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="#11ff00" />
<corners android:radius="30dp" />
</shape>
</clip>
</item>
</layer-list>
xml of thumb_custom:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffe38c" />
<size
android:width="35dp"
android:height="35dp" />
<corners android:radius="35dp" />
<item android:id="@android:id/background"
android:drawable="@drawable/led_sang"/>
</shape>
答案 0 :(得分:4)
我已经通过替换此行PdfPTable table = new PdfPTable(5);
table.TotalWidth = 510f;//table size
table.LockedWidth = true;
table.HorizontalAlignment = 0;
table.SpacingBefore = 10f;//both are used to mention the space from heading
table.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
table.AddCell(new Phrase(new Phrase(" SL.NO", font1)));
table.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
table.AddCell(new Phrase(new Phrase(" SUBJECTS", font1)));
table.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
table.AddCell(new Phrase(new Phrase(" MARKS", font1)));
table.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
table.AddCell(new Phrase(new Phrase(" MAX MARK", font1)));
table.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
table.AddCell(new Phrase(new Phrase(" CLASS AVG", font1)));
Doc.Add(table);
解决了这个问题
到android:progressDrawable="@drawable/background_custom"
。这将使50%透明的黄色。
答案 1 :(得分:2)
试试这个,
设置搜索栏。
<SeekBar
....
android:progressDrawable="@drawable/progress"
android:thumb="@drawable/thumb"
....
/>
在res / drawable中写入progress.xml,如。
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background"
android:drawable="@drawable/background_fill" />
<item android:id="@android:id/progress">
<clip android:drawable="@drawable/progress_fill" />
</item>
</layer-list>
在res / drawable文件夹中写入thumb.xml。
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/thumb_fill" />
</selector>
希望它的工作。
答案 2 :(得分:0)
看看documenatation; SeekBar
是一个ProgressBar
因此可以解决辅助进度和主要进度问题..
希望有所帮助
答案 3 :(得分:0)
您的搜索栏:
<SeekBar
android:id="@+id/slider"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:max="5"
android:progress="0"
android:progressDrawable="@drawable/progress_drawable" />
progress_drawable.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="10dip" />
<gradient
android:startColor="#ff9d9e9d"
android:centerColor="#ff5a5d5a"
android:centerY="0.75"
android:endColor="#ff747674"
android:angle="270"
/>
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="5dip" />
<gradient
android:startColor="#80ffd300"
android:centerColor="#80ffb600"
android:centerY="0.75"
android:endColor="#a0ffcb00"
android:angle="270"
/>
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip
android:clipOrientation="horizontal"
android:gravity="left">
<shape>
<corners
android:radius="5dip" />
<gradient
android:startColor="@color/greenStart"
android:centerColor="@color/greenMid"
android:centerY="0.75"
android:endColor="@color/greenEnd"
android:angle="270"
/>
</shape>
</clip>
</item>
</layer-list>
答案 4 :(得分:0)
<SeekBar
android:id="@+id/brightbar"
android:layout_width="@dimen/versepage_seekboar_w"
android:layout_height="wrap_content"
android:layout_below="@id/Device"
android:layout_marginLeft="24dp"
android:layout_marginRight="20dp"
android:layout_marginTop="2dp"
android:maxHeight="2dp"
android:progressDrawable="@drawable/seekbar_progress"
android:thumb="@drawable/ic_slider_thumb1" >
</SeekBar>
seekbar.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/background">
<shape android:shape="rectangle" >
<corners android:radius="1dp" />
<gradient
android:angle="270"
android:endColor="@color/seekbar_clr2"
android:startColor="@color/seekbar_clr2" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape android:shape="rectangle" >
<corners android:radius="1dp" />
<gradient
android:angle="270"
android:endColor="@color/seekbar_clr2"
android:startColor="@color/seekbar_clr" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape android:shape="rectangle" >
<corners android:radius="1dp" />
<gradient
android:angle="270"
android:endColor="@color/seekbar_clr"
android:startColor="@color/seekbar_clr" />
</shape>
</clip>
</item>