skip to Main Content

I am begineer in Android Development. I am making a XML layout but the property of textSize not showing also the code which generated automatically when we type not generating like if we type match then studio will show match_parent that is not generating. How to solve this?

<?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"// this line is showing in black
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="?attr/actionBarSize">

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/nav_view"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="0dp"
        android:layout_marginEnd="0dp"
        android:background="?android:attr/windowBackground"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:menu="@menu/bottom_nav_menu" />

 <TextView
    android:layout_height="wrap_content"
android:layout_width="match_parent"/>
    
</androidx.constraintlayout.widget.ConstraintLayout>

also when I tried to drag and drop it again not showing attributes of textview like textstyle, textsize etc.

enter image description here

I am trying to increase my text size but the property in attributes not showing it.

3

Answers


  1. You seem to be having project and/or IDE errors. Have you tried syncing with gradle or Invalidating cache and restarting Android Studio?

    Login or Signup to reply.
  2. It seems to be occured error, and TextView if in ConstraintLayout must be have app:layout_constraintBottom_toBottomOf property

    so I suggest below code

    <?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:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingTop="?attr/actionBarSize">
    
        <com.google.android.material.bottomnavigation.BottomNavigationView
            android:id="@+id/nav_view"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginStart="0dp"
            android:layout_marginEnd="0dp"
            android:background="?android:attr/windowBackground"
            app:layout_constraintBottom_toBottomOf="parent"
            app:menu="@menu/bottom_nav_menu"/>
    
     <TextView
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        app:layout_constraintBottom_toBottomOf="parent"/>
        
    </androidx.constraintlayout.widget.ConstraintLayout>
    
    Login or Signup to reply.
  3. Please, check your gradle config file(module level) and
    set the attributes
    compileSdk and targetSdk
    with at most Android API version 32

    Example:

    android {
    compileSdk 32
    defaultConfig {
        applicationId "com.example.droidcafe"
        minSdk 21
        targetSdk 32
        versionCode 1
        versionName "1.0." + versionCode
    //minimized code...
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search