تابستون داره تموم میشه ها، فرصت‌ها محدودن کلی آفر جذاب در کمپین تابستون🔥👇
۰ ثانیه
۰ دقیقه
۰ ساعت
۶ محمدجواد اوجی
text_view
پوریا شفیعی حل شده توسط پوریا شفیعی

سلام 

در دقیقه 25 فیلم ، استاد یک text_view می‌سازه و بعد در Emulator نمایش داده میشه.

 

اما برای من بدون ساختن text_view ، در Emulator  ساخته میشه.

 

چرا؟!!!!.لطفا راهنمایی بفرمایید

 

تصویر به پیوست ارسال شد

سلام 

 

متوجه منظورتون نشدم یعنی میخواهید متن نمایشی تغییر کنه؟

 

 

پوریا شفیعی ۱۴ اسفند ۱۳۹۹، ۲۱:۱۴

نخیر .نمیخوام متن نمایشی تغییر کنه.

 

منظورم این هست که ، داخل فیلم (دقیقه 25) مشاهده می‌شود که یک text_view ساخته می‌شود سپس بعد از Run  کردن برنامه در Emulator  اون text_viewنشان داده میشود.

حال برای من خلاف این موضوع هست.

 

در تصویری که در پیوست گذاشتم مشاهده میکنید ، من هیچ text_viewتعریف نکردم اما زمانی که برنامه را Run  می کنم ، در Emulator آن  text_view را مشاهده میکنم

محمدجواد اوجی ۱۴ اسفند ۱۳۹۹، ۲۱:۲۴

سلام

به پیوست کد XML ارسال گردید

محمدجواد اوجی ۱۵ اسفند ۱۳۹۹، ۰۸:۳۱

سلام وقت بخیر

 

شما یک textview اضافی اضافه کرده بودید که من براتون اون رو حذفم.

این textview قبل از RadioGroup بود.

<?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"
    android:background="@color/gray100"
    tools:context=".MainActivity">
    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginLeft="8dp"
        android:background="@drawable/background_button_seconry"
        android:paddingLeft="20dp"
        android:paddingRight="20dp"
        android:text="@string/viewWebsite"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toEndOf="@+id/button"
        app:layout_constraintTop_toTopOf="@+id/button" />
    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="12dp"
        android:background="@drawable/background_button_primary"
        android:paddingLeft="20dp"
        android:paddingRight="20dp"
        android:text="@string/editProfile"
        android:textAppearance="@style/TextAppearance.AppCompat.Body1"
        android:textColor="@android:color/background_light"
        app:layout_constraintEnd_toStartOf="@+id/button2"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView" />
    <ImageView
        android:id="@+id/imageView"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_marginTop="108dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.495"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/z4" />
    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="12dp"
        android:text="TextView"
        android:textColor="@android:color/background_dark"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/imageView"
        tools:text="saeed shahini" />
    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:text="@string/skills"
        android:textColor="@color/gray600"
        app:layout_constraintStart_toStartOf="@+id/guideline2"
        app:layout_constraintTop_toBottomOf="@+id/button" />
    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_begin="24dp"
        app:layout_constraintGuide_end="387dp" />
    <CheckBox
        android:id="@+id/checkBox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="4dp"
        android:text="@string/androidDevelopment"
        app:layout_constraintStart_toStartOf="@+id/guideline2"
        app:layout_constraintTop_toBottomOf="@+id/textView2" />
    <CheckBox
        android:id="@+id/checkBox2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/uiDesign"
        app:layout_constraintStart_toStartOf="@+id/guideline2"
        app:layout_constraintTop_toBottomOf="@+id/checkBox" />
    <CheckBox
        android:id="@+id/checkBox3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/deepLearning"
        app:layout_constraintStart_toStartOf="@+id/guideline2"
        app:layout_constraintTop_toBottomOf="@+id/checkBox2" />
    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="32dp"
        android:text="@string/provinceCity"
        app:layout_constraintStart_toStartOf="@+id/guideline2"
        app:layout_constraintTop_toBottomOf="@+id/checkBox3" />
    <Button
        android:id="@+id/button3"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="@drawable/background_button_primary"
        android:text="@string/saveInformation"
        android:textColor="#F8F4F4"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />
    <RadioGroup
        android:layout_width="54dp"
        android:layout_height="25dp"
        app:layout_constraintStart_toStartOf="@+id/guideline2"
        app:layout_constraintTop_toBottomOf="@+id/textView3" >
        <RadioButton
            android:id="@+id/radioButton3"
            android:layout_width="147dp"
            android:layout_height="75dp"
            android:text="@string/gilanRasht" />
        <RadioButton
            android:id="@+id/radioButton2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/alborzKaraj" />
        <RadioButton
            android:id="@+id/radioButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/tehran" />
    </RadioGroup>
</androidx.constraintlayout.widget.ConstraintLayout>
پوریا شفیعی ۱۵ اسفند ۱۳۹۹، ۱۷:۵۵

سلام .وقتتون بخیر

 

ممنون از پاسخ که دادید.

 

ولی پاسخ مناسب دریافت نکردم.

 

شما این text- view اضافی را حذف کردید و دیگه text_view  ندارید.

 

من از شما میخوام برنامه را ران کنید سپس در emulator (قسمت مشخص شده به رنگ قرمز در فایل پیوست) این قسمت مشاهده میکنید که در کد اکس ام ال تعریف نشده  ، اما داره نمایش میدهد.

 

سوال من اینه که چطور کدی برای قسمت مشخص شده نزدیم اما نمایش داده میشه؟

محمدجواد اوجی ۱۵ اسفند ۱۳۹۹، ۱۸:۰۸

سلام مجدد 

 

این قسمت Action Bar(تولبار) نام داره و باید از themes.xml به NoActionBar تغییر بدید تا براتون نمایش داده نشه 

و پس از آن اگر نیاز دارید تولبار کاستوم خودتون رو بسازید (میتونید با TextView بسازید)

پس به themes.xml رفته و پس از آن parent رو به مقدار زیر تغییر بدید.

در تکه کد زیر به NoActionBar دقت کنید که داریم میگوییم اکشن باری برای اپلیکیشن نمایش نده

parent="Theme.AppCompat.Light.NoActionBar" 

نمونه کد لیوتتون

<?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"
    android:background="@color/gray100"
    tools:context=".MainActivity">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="56dp"
        android:background="#ff00"
        android:gravity="center_vertical"
        android:text="موزش ویو‌های اندروید"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginLeft="8dp"
        android:background="@drawable/background_button_seconry"
        android:paddingLeft="20dp"
        android:paddingRight="20dp"
        android:text="@string/viewWebsite"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toEndOf="@+id/button"
        app:layout_constraintTop_toTopOf="@+id/button" />
    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="12dp"
        android:background="@drawable/background_button_primary"
        android:paddingLeft="20dp"
        android:paddingRight="20dp"
        android:text="@string/editProfile"
        android:textAppearance="@style/TextAppearance.AppCompat.Body1"
        android:textColor="@android:color/background_light"
        app:layout_constraintEnd_toStartOf="@+id/button2"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView" />
    <ImageView
        android:id="@+id/imageView"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_marginTop="108dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.495"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/z4" />
    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="12dp"
        android:text="TextView"
        android:textColor="@android:color/background_dark"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/imageView"
        tools:text="saeed shahini" />
    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:text="@string/skills"
        android:textColor="@color/gray600"
        app:layout_constraintStart_toStartOf="@+id/guideline2"
        app:layout_constraintTop_toBottomOf="@+id/button" />
    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_begin="24dp"
        app:layout_constraintGuide_end="387dp" />
    <CheckBox
        android:id="@+id/checkBox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="4dp"
        android:text="@string/androidDevelopment"
        app:layout_constraintStart_toStartOf="@+id/guideline2"
        app:layout_constraintTop_toBottomOf="@+id/textView2" />
    <CheckBox
        android:id="@+id/checkBox2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/uiDesign"
        app:layout_constraintStart_toStartOf="@+id/guideline2"
        app:layout_constraintTop_toBottomOf="@+id/checkBox" />
    <CheckBox
        android:id="@+id/checkBox3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/deepLearning"
        app:layout_constraintStart_toStartOf="@+id/guideline2"
        app:layout_constraintTop_toBottomOf="@+id/checkBox2" />
    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="32dp"
        android:text="@string/provinceCity"
        app:layout_constraintStart_toStartOf="@+id/guideline2"
        app:layout_constraintTop_toBottomOf="@+id/checkBox3" />
    <Button
        android:id="@+id/button3"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="@drawable/background_button_primary"
        android:text="@string/saveInformation"
        android:textColor="#F8F4F4"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />
    <RadioGroup
        android:layout_width="54dp"
        android:layout_height="25dp"
        app:layout_constraintStart_toStartOf="@+id/guideline2"
        app:layout_constraintTop_toBottomOf="@+id/textView3" >
        <RadioButton
            android:id="@+id/radioButton3"
            android:layout_width="147dp"
            android:layout_height="75dp"
            android:text="@string/gilanRasht" />
        <RadioButton
            android:id="@+id/radioButton2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/alborzKaraj" />
        <RadioButton
            android:id="@+id/radioButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/tehran" />
    </RadioGroup>
</androidx.constraintlayout.widget.ConstraintLayout>
بهترین پاسخ
پوریا شفیعی ۱۵ اسفند ۱۳۹۹، ۱۹:۳۴