просто посмотрите на картинку, пожалуйста, проблема в том, что мой поисковый палец показывает первоначальный вид, несмотря на то, что я его ищу - PullRequest
0 голосов
/ 22 января 2020

enter image description here

из-за того, что все мои панели поиска выдавали даже любое представление, показывающее его начальное значение, а также во время выполнения, я вынуждаю класс framgent из действия и инициализирую его представления, работающие нормально но проблемы с печатью представлений или исходным значением все еще существуют, даже с такими, как подсказки редактирования текста в строке поиска, показывающие, что я что-то там пишу FragmentClass

`override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {

        // Inflate the layout for this fragment
        val view: View = inflater.inflate(R.layout.volumefragment, container,
            false)
        Ringervolume = view.findViewById<View>(R.id.seekBar) as SeekBar
        alarmvolume = view.findViewById<View>(R.id.seekBar1) as SeekBar
        vibrationset = view.findViewById<View>(R.id.seekBar2) as SeekBar
        donotdistrub = v
iew.findViewById<View>(R.id.switch1) as Switch
        silentmode = view.findViewById<View>(R.id.switch2) as Switch
        musicvolume = view.findViewById<View>(R.id.seekBar4) as SeekBar

MainActivity

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

       setSupportActionBar(findViewById(R.id.my_toolbar))

        val fragmentManager = supportFragmentManager
        val fragmentTransaction = fragmentManager.beginTransaction()
        val fragment = VolumeFagment()
        fragmentTransaction.add(R.id.list, fragment)
        fragmentTransaction.commit()
 getSupportActionBar()!!.setTitle("Sounds")

Fragment_xml это файл xml Я не думаю, что есть проблема в файле xml, но это

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
    android:layout_height="match_parent">


    <androidx.appcompat.widget.Toolbar
        android:id="@+id/my_toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@null"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        tools:ignore="MissingConstraints" />

    <SeekBar
        android:id="@+id/seekBar"
        android:layout_width="318dp"
        android:layout_height="16dp"
        android:layout_marginStart="4dp"
        android:layout_marginLeft="4dp"
        android:layout_marginTop="136dp"

        app:layout_constraintStart_toEndOf="@+id/volumedownimg"
        app:layout_constraintTop_toTopOf="parent" />


    <SeekBar
        android:id="@+id/seekBar1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="50dp"
        android:layout_marginStart="16dp"
        android:layout_marginLeft="16dp"
        android:layout_marginTop="104dp"
        android:splitTrack="false"
        app:layout_constraintStart_toEndOf="@+id/vibrationimg"
        app:layout_constraintTop_toBottomOf="@+id/seekBar2" />

    <SeekBar
        android:id="@+id/seekBar3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="50dp"
        android:layout_marginTop="20dp"
        android:splitTrack="false"
        app:layout_constraintStart_toEndOf="@+id/vibrationimg"
        app:layout_constraintTop_toBottomOf="@+id/seekBar2" />

    <SeekBar
        android:id="@+id/seekBar4"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="50dp"
        android:layout_marginStart="4dp"
        android:layout_marginLeft="4dp"
        android:layout_marginTop="48dp"

        android:splitTrack="false"
        app:layout_constraintStart_toEndOf="@+id/vibrationimg2"
        app:layout_constraintTop_toBottomOf="@+id/seekBar1" />

    <SeekBar
        android:id="@+id/seekBar6"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:splitTrack="false"
        app:layout_constraintTop_toBottomOf="@+id/textView4"
        tools:layout_editor_absoluteX="0dp" />

    <View
        android:id="@+id/view"
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:layout_marginTop="88dp"
        android:background="#FF0000FF"
        app:layout_constraintTop_toBottomOf="@+id/seekBar1"
        tools:ignore="MissingConstraints"
        tools:layout_editor_absoluteX="0dp" />

    <View
        android:id="@+id/view2"
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:layout_marginTop="48dp"

        android:background="#FF0000FF"
        app:layout_constraintTop_toBottomOf="@+id/view"
        tools:ignore="MissingConstraints"
        tools:layout_editor_absoluteX="8dp" />

    <SeekBar
        android:id="@+id/seekBar2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="50dp"
        android:layout_marginTop="52dp"

        android:splitTrack="false"
        app:layout_constraintStart_toEndOf="@+id/alarmimg"
        app:layout_constraintTop_toBottomOf="@+id/seekBar" />

    <ImageView
        android:id="@+id/volumedownimg"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="128dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/outline_volume_off_black_18dp" />

    <ImageView
        android:id="@+id/vibrationimg"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="32dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/alarmimg"
        app:srcCompat="@drawable/outline_volume_off_black_18dp" />

    <ImageView
        android:id="@+id/vibrationimg2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="32dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/vibrationimg"
        app:srcCompat="@drawable/outline_volume_off_black_18dp" />

    <ImageView
        android:id="@+id/alarmimg"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="28dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/volumedownimg"
        app:srcCompat="@drawable/outline_volume_off_black_18dp" />

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="60dp"
        android:layout_marginLeft="60dp"
        android:layout_marginBottom="16dp"
        android:text="Ring Volume"
        app:layout_constraintBottom_toTopOf="@+id/seekBar"
        app:layout_constraintStart_toStartOf="parent" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="60dp"
        android:layout_marginLeft="60dp"
        android:text="Media Volume"
        app:layout_constraintBottom_toTopOf="@+id/seekBar2"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/seekBar"
        app:layout_constraintVertical_bias="0.387" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="60dp"
        android:layout_marginLeft="60dp"
        android:text="Alarm Volume"
        app:layout_constraintBottom_toTopOf="@+id/seekBar1"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/seekBar2"
        app:layout_constraintVertical_bias="0.258" />

    <TextView
        android:id="@+id/textView6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="60dp"
        android:layout_marginLeft="60dp"
        android:layout_marginTop="8dp"
        android:text="Music  Volume"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/seekBar1" />

    <TextView
        android:id="@+id/textView5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="44dp"
        android:layout_marginLeft="44dp"
        android:layout_marginTop="16dp"
        android:text="Do Not Distrub"
        app:layout_constraintBottom_toTopOf="@+id/view2"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/view"
        app:layout_constraintVertical_bias="0.26999998" />

    <Switch
        android:id="@+id/switch1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="48dp"
        android:layout_marginRight="48dp"
        android:text=""
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toEndOf="@+id/textView7"
        app:layout_constraintTop_toBottomOf="@+id/view2" />

    <Switch
        android:id="@+id/switch2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="48dp"
        android:layout_marginRight="48dp"
        android:text=""
        app:layout_constraintBottom_toTopOf="@+id/view2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toEndOf="@+id/textView5"
        app:layout_constraintTop_toBottomOf="@+id/view"
        app:layout_constraintVertical_bias="0.26" />

    <TextView
        android:id="@+id/textView7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="44dp"
        android:layout_marginLeft="44dp"
        android:layout_marginTop="8dp"
        android:text="Also vibrate for calls"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/view2" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="44dp"
        android:layout_marginLeft="44dp"
        android:layout_marginTop="8dp"
        android:text="phone ringtone"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView7" />

    <SeekBar
        android:id="@+id/seekBar7"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/seekBar6" />

    <EditText
        android:id="@+id/editText"
        android:layout_width="89dp"
        android:layout_height="34dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="16dp"
        android:layout_marginRight="16dp"
        android:ems="10"
        android:hint="Profile"
        android:inputType="textPersonName"
        android:textSize="10dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/my_toolbar" />
</androidx.constraintlayout.widget.ConstraintLayout>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...