SeekBar使用style="?android:attr/progressBarStyleHorizontal"

今天在使用seekbar遇到一个问题,也不是大问题,但是有强迫症,总觉得不舒服,就是右边显示的布局总弹出Rendering Problems。
这里写图片描述

运行没有问题,一样可以用,就是在写XML时很不爽,总感觉有什么问题。看一下seekbar代码。

    <SeekBar
        android:id="@+id/play_progress"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="match_parent"
        android:layout_height="3dp"
        android:layout_marginBottom="-2dp"
        android:layout_marginLeft="-17dp"
        android:layout_marginRight="-17dp"
        android:layout_marginTop="-3dp"
        android:progressDrawable="@drawable/music_progress_bg"
        android:thumb="@null" />

detail中表达意思大概就是seekbar的问题,我找到两种办法可以不弹出来,①API调成20就不弹出来,②或者把style=”?android:attr/progressBarStyleHorizontal”删掉也不弹出来。运行也不影响,上网查style=”?android:attr/progressBarStyleHorizontal”这个就是水平的进度条样式。

具体原因不太清除,但是我搜了一下style=”?android:attr/progressBarStyleHorizontal”这个属性是progressbar的,按理来说seekbar是progressBar子类的子类应该可以用,但是不知道哪里的问题;还有吧API调低也不弹出来,不知道什么原因。

这种问题遇到最多的就是导入github上的项目时,经常遇到。知道的大神欢迎留言。

好的,你可以在布局文件中添加两个 Button 控件,如下所示: ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <EditText android:id="@+id/ipEditText" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="请输入服务器IP地址" /> <EditText android:id="@+id/portEditText" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="请输入服务器端口号" /> <Button android:id="@+id/connectButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="连接" /> <SeekBar android:id="@+id/seekBar_x" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:max="30" android:progress="0" /> <ScrollView android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"> <SeekBar android:id="@+id/seekBar_y" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="32dp" android:max="30" android:progress="0" /> </ScrollView> <Button android:id="@+id/sendMessageButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="发送消息" /> <Button android:id="@+id/cancelButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="取消" /> <Button android:id="@+id/confirmButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="确认" /> </LinearLayout> ``` 这样就在布局文件中添加了两个按钮:取消和确认。你可以根据需要修改按钮的文本和样式。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值