17_Android效果:SeekBar的简单使用

本文详细介绍了如何在Android中自定义SeekBar的背景图片、使用XML定义样式,并结合代码实现带进度显示的功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Android基础汇总一.    自定义seekBar样

ssq

 

#1 定义seekBar背景图片:    
 
<?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/user_management_myseekbar_background">
    </item>
     <item
        android:id="@android:id/secondaryProgress"
        android:drawable="@drawable/user_management_myseekbar_background">
    </item>
<!-- 设置第二进度:一般视频的缓存效果-->
    <item
        android:id="@android:id/progress"
        android:drawable="@drawable/user_management_myseekbar_progress">
    </item>

</layer-list>
 
#2 使用
 <SeekBar
                    android:layout_gravity="center_horizontal"
                    android:id="@+id/seekBar"
                     android:layout_width="284dp" 设置宽度最好根据背景图片一点点调
                    android:layout_height="wrap_content"
                    android:max="100"
                    android:maxHeight="16dp"
                    android:minHeight="16dp"
                     android:thumbOffset="0dp" 默认滑块中间从进度条开始滑动,设置为0dp则滑块最左边从进度条开始滑动
                    android:progress="0"
                     android:progressDrawable="@drawable/seekbar_style"  设置背景图片和进度的图片
                     android:thumb="@drawable/my_seekbar_thumb" /> 设置滑块的图片
 
二、 SeekBar带进度显示
ssq
# 1图片:
my_seekbar_thumb.png
ssq
user_management_myseekbar_background.png
ssq
user_management_myseekbar_progress.png
ssq
#2 xml:
        seekbar_style.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/user_management_myseekbar_background">
 
    </item>
 
 
    <item
 
        android:id="@android:id/progress"
 
        android:drawable="@drawable/user_management_myseekbar_progress">
 
    </item>
 
</layer-list>
 
fragment_main.xml:
        <LinearLayout xmlns:android=" http://schemas.android.com/apk/res/android"
    xmlns:tools=" http://schemas.android.com/tools"
 
    android:layout_width="match_parent"
 
    android:layout_height="match_parent"
 
    android:orientation="vertical"
 
    android:paddingBottom="@dimen/activity_vertical_margin"
 
    android:paddingLeft="@dimen/activity_horizontal_margin"
 
    android:paddingRight="@dimen/activity_horizontal_margin"
 
    android:paddingTop="@dimen/activity_vertical_margin"
 
    tools:context="com.bpj.setlevel.MainActivity$PlaceholderFragment" >
 
 
    <TextView
 
        android:layout_marginLeft="26dp"
 
        android:id="@+id/tv_hint"
 
        android:layout_width="wrap_content"
 
        android:layout_height="wrap_content"
 
        android:text="0" />
 
 
    <SeekBar
 
        android:id="@+id/seekbar"
 
        android:layout_width="315dp"
 
        android:layout_height="wrap_content"
 
        android:max="100"
 
        android:layout_marginTop="20dp"
 
        android:progressDrawable="@drawable/seekbar_style"
 
        android:thumb="@drawable/my_seekbar_thumb"
 
        android:thumbOffset="0dp" />
 
 
</LinearLayout>
 
# 3 代码:
        public class MainActivity extends Activity {
 
 private TextView tv_hint;
 private SeekBar seekbar;
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.fragment_main);
  tv_hint = (TextView) findViewById(R.id.tv_hint);
  tv_hint.setText("0");
 
  seekbar = (SeekBar) findViewById(R.id.seekbar);
  seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
   
   @Override
   public void onStopTrackingTouch(SeekBar seekBar) {
   
   }
   
   @Override
   public void onStartTrackingTouch(SeekBar seekBar) {
   
   }
   
   @Override
   public void onProgressChanged(SeekBar seekBar, int progress,
     boolean fromUser) {
    tv_hint.setText(progress+"");
    int width = tv_hint.getWidth();
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);  
    float i = (float) (2.65*progress+26);
    int left = dip2px(MainActivity.this, i)-width/2;
    lp.setMargins(left, 0, 0, 0);
    tv_hint.setLayoutParams(lp);
   
   }
  });
 
 }
 
 public int dip2px(Context context, float dpValue) {  
        final float scale = context.getResources().getDisplayMetrics().density;  
        return (int) (dpValue * scale + 0.5f);  
    }
}
    
 

 

 

 

 

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@mipmap/wallpaper1" android:orientation="vertical" tools:context=".activity.MainActivity"> <Button android:id="@+id/bt_start_float" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:text="打开悬浮窗"> </Button> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_marginTop="15dp" android:layout_weight="0.5" android:gravity="center_vertical" android:orientation="horizontal" android:paddingLeft="12dp" android:paddingTop="6dp" android:paddingRight="12dp" android:paddingBottom="6dp"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/ic_logo" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:text="导播系统" android:textColor="@color/text_color" android:textSize="@dimen/text_16sp" android:textStyle="bold" /> <View android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1" /> <ImageView android:id="@+id/ic_zhuti" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/ic_zhuti" /> <ImageView android:id="@+id/ic_shumingshuo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="14dp" android:background="@mipmap/ic_shumingshuo" /> <ImageView android:id="@+id/ic_tuichu" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="14dp" android:background="@mipmap/ic_tuichu" /> <ImageView android:id="@+id/ic_shezhi" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="14dp" android:background="@mipmap/ic_shezhi" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_marginLeft="12dp" android:layout_marginRight="12dp" android:layout_weight="1" android:orientation="horizontal"> <LinearLayout android:id="@+id/start_living" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:background="@mipmap/bg_ground11" android:gravity="center_vertical" android:orientation="vertical" android:padding="12dp"> </LinearLayout> <LinearLayout android:id="@+id/btn_shortcut" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginLeft="10dp" android:layout_weight="1" android:background="@mipmap/bg_ground111" android:gravity="center_vertical" android:orientation="vertical" android:padding="12dp"> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_margin="12dp" android:layout_weight="5.1" android:orientation="horizontal"> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical"> <TextureView android:id="@+id/texture" android:layout_width="match_parent" android:layout_height="match_parent" android:keepScreenOn="true" android:visibility="gone" /> <com.cw.liveguidestation.view.layer.MultiLayerEditor android:id="@+id/layerEditor" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout> <LinearLayout android:id="@+id/ll_sound" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginStart="10dp" android:layout_weight="1" android:orientation="vertical" android:visibility="visible"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/nav_rlv1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/bg_nav" android:orientation="horizontal" /> <FrameLayout android:id="@+id/fragment_container1" android:layout_width="match_parent" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:id="@+id/ll_video" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginStart="10dp" android:layout_weight="1" android:orientation="vertical" android:visibility="gone"> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:orientation="horizontal"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/bg_de" android:gravity="center" android:orientation="horizontal"> <TextView android:id="@+id/jiweiChange" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="一号机位" android:textColor="@color/text_color" android:textSize="@dimen/text_12sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:background="@mipmap/ic_xiala1" /> </LinearLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:background="@mipmap/btn_ok" android:gravity="center" android:paddingLeft="5dp" android:paddingTop="2dp" android:paddingRight="5dp" android:paddingBottom="2dp" android:text="确认" android:textColor="@color/text_color" android:textSize="@dimen/text_12sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="15dp" android:background="@mipmap/btn_esc" android:gravity="center" android:paddingLeft="5dp" android:paddingTop="2dp" android:paddingRight="5dp" android:paddingBottom="2dp" android:text="停止" android:textColor="@color/text_color" android:textSize="@dimen/text_12sp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:gravity="center_vertical" android:orientation="horizontal"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/ic_bg" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:gravity="center" android:text="背景画面" android:textColor="@color/text_color" android:textSize="@dimen/text_12sp" /> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/ic_h" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:background="@mipmap/ic_v" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:orientation="horizontal"> <LinearLayout android:id="@+id/llImageBg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="图片" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> <ImageView android:id="@+id/ivImageBg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="3dp" android:background="@mipmap/sel_l" android:visibility="invisible" /> </LinearLayout> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <LinearLayout android:id="@+id/llCameraBg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:gravity="center_horizontal" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="摄像头" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> <ImageView android:id="@+id/ivCameraBg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="3dp" android:background="@mipmap/sel_l" android:visibility="invisible" /> </LinearLayout> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <LinearLayout android:id="@+id/llVideoBg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:gravity="center_horizontal" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="视频" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> <ImageView android:id="@+id/ivVideoBg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="3dp" android:background="@mipmap/sel_l" android:visibility="invisible" /> </LinearLayout> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <LinearLayout android:id="@+id/llSlideBg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:gravity="center_horizontal" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="幻灯片" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> <ImageView android:id="@+id/ivSlideBg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="3dp" android:background="@mipmap/sel_l" android:visibility="invisible" /> </LinearLayout> </LinearLayout> <androidx.recyclerview.widget.RecyclerView android:id="@+id/rvContentBg" android:layout_width="match_parent" android:layout_height="wrap_content" /> <!-- <ImageView--> <!-- android:layout_width="wrap_content"--> <!-- android:layout_height="wrap_content"--> <!-- android:layout_marginTop="10dp"--> <!-- android:background="@mipmap/ic_add" />--> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:gravity="center_vertical" android:orientation="horizontal"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/ic_bg" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:gravity="center" android:text="主播画面" android:textColor="@color/text_color" android:textSize="@dimen/text_12sp" /> <androidx.appcompat.widget.SwitchCompat android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" app:thumbTint="@color/text_color" app:trackTint="@color/switch_color" /> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/ic_h" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:background="@mipmap/ic_v" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:orientation="horizontal"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="摄像头" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="3dp" android:background="@mipmap/sel_l" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:gravity="center_horizontal" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="数字人" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="3dp" android:background="@mipmap/sel_l" /> </LinearLayout> </LinearLayout> <!-- <androidx.recyclerview.widget.RecyclerView--> <!-- android:layout_width="match_parent"--> <!-- android:layout_height="wrap_content"/>--> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:background="@mipmap/ic_add" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:gravity="center_vertical" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="扣绿幕" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> <androidx.appcompat.widget.SwitchCompat android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" app:thumbTint="@color/text_color" app:trackTint="@color/switch_color" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:gravity="center_vertical" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="色相值" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> <androidx.appcompat.widget.AppCompatSeekBar style="@style/CustomVerticalSeekBar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0/100" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:gravity="center_vertical" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="平滑度" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> <androidx.appcompat.widget.AppCompatSeekBar style="@style/CustomVerticalSeekBar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0/100" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:gravity="center_vertical" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="相似度" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> <androidx.appcompat.widget.AppCompatSeekBar style="@style/CustomVerticalSeekBar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0/100" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:gravity="center_vertical" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="绿校对" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> <androidx.appcompat.widget.AppCompatSeekBar style="@style/CustomVerticalSeekBar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0/100" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:gravity="center_vertical" android:orientation="horizontal"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/ic_bg" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:gravity="center" android:text="前景画面" android:textColor="@color/text_color" android:textSize="@dimen/text_12sp" /> <androidx.appcompat.widget.SwitchCompat android:id="@+id/switchFg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" app:thumbTint="@color/text_color" app:trackTint="@color/switch_color" /> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/ic_h" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:background="@mipmap/ic_v" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:orientation="horizontal"> <LinearLayout android:id="@+id/llIMageFg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="图片" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> <ImageView android:id="@+id/ivImageFg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="3dp" android:visibility="invisible" android:background="@mipmap/sel_l" /> </LinearLayout> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <LinearLayout android:id="@+id/llCameraFg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:gravity="center_horizontal" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="摄像头" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> <ImageView android:id="@+id/ivCameraFg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="3dp" android:visibility="invisible" android:background="@mipmap/sel_l" /> </LinearLayout> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <LinearLayout android:id="@+id/llVideoFg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:gravity="center_horizontal" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="视频" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> <ImageView android:id="@+id/ivVideoFg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="3dp" android:visibility="invisible" android:background="@mipmap/sel_l" /> </LinearLayout> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <LinearLayout android:id="@+id/llSlideFg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:gravity="center_horizontal" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="幻灯片" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> <ImageView android:id="@+id/ivSlideFg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="3dp" android:visibility="invisible" android:background="@mipmap/sel_l" /> </LinearLayout> </LinearLayout> <androidx.recyclerview.widget.RecyclerView android:id="@+id/rvContentFg" android:layout_width="match_parent" android:layout_height="wrap_content" /> <!-- <ImageView--> <!-- android:layout_width="wrap_content"--> <!-- android:layout_height="wrap_content"--> <!-- android:layout_marginTop="10dp"--> <!-- android:background="@mipmap/ic_add" />--> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:gravity="center_vertical" android:orientation="horizontal"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/ic_bg" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:gravity="center" android:text="音频输入" android:textColor="@color/text_color" android:textSize="@dimen/text_12sp" /> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> </LinearLayout> <!-- <androidx.recyclerview.widget.RecyclerView--> <!-- android:layout_width="match_parent"--> <!-- android:layout_height="wrap_content"/>--> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:background="@mipmap/ic_add" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:text="请对着音频输入设备说话,检测声音" android:textColor="@color/text_color" android:textSize="@dimen/text_10sp" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:gravity="center_vertical" android:orientation="horizontal"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/ic_bg" /> <androidx.appcompat.widget.AppCompatSeekBar style="@style/CustomVerticalSeekBar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_weight="1" /> </LinearLayout> </LinearLayout> </ScrollView> </LinearLayout> </LinearLayout> <SeekBar android:id="@+id/progressBar" android:layout_width="match_parent" android:layout_height="wrap_content" android:max="100" android:progress="0" android:visibility="gone" app:layout_constraintBottom_toTopOf="@+id/tvvv" tools:ignore="MissingConstraints" /> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_marginLeft="12dp" android:layout_marginRight="12dp" android:layout_weight="3.4" android:background="@mipmap/bg_ground2" android:orientation="vertical"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/nav_rlv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:orientation="horizontal" /> <FrameLayout android:id="@+id/fragment_container" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout> </LinearLayout> 这个布局中的layerEditor添加全屏和非全屏效果
最新发布
06-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值