wrap content در اندروید استودیو کار نمیکند!!!!

سلام شروع کردن به یادگیری برنامه نویس اندروید طبق اموزش ها دارم پیش میرم ولی مشکلی که دارم wrap contet در اندروید استودیو من کار نمیکنه و خیلی عجیبه !!!!!!!!!!! اینم عکسش :

اینجا گزینه اپلود عکس نداره وگرنه عکسش میزاشتم ._. ._. 

باید قاعدتا الان لایه ای که کلمه book توش نوشته شده یعنی تکست ویو من عرض معادل متن داشته باشه ولی نیس چرا خب تازه روی  ورپ کانتنت هم هس!

پاسخ ها

sokanacademy forum
کاربر سکان آکادمی 5 سال پیش

سلام دوست عزیز حداقل نمونه کد هاتو بزار تا ببینیم چیکار کردی!!

sokanacademy forum
کاربر سکان آکادمی 5 سال پیش
<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/holo_green_light"
android:text="book" />
</LinearLayout>
</LinearLayout>

</LinearLayout>
sokanacademy forum
کاربر سکان آکادمی 5 سال پیش
android:layout_weight="1"

این رو حذف کن احتمال زیاد درست میشه.

layout_weight موقعی استفاده میشه که توی LinearLayout از weightSum استفاده کرده باشی. 

کاربرد weightSum هم برای وقتیه که بخوای فضای اشغال شده توسط LinearLayout رو نسبت بندی بکنی. مثلا عددش رو میذاری 3، و واسه سه تا تکست ویو وزن 1 رو وارد میکنی که به سه قسمت مساوی تقسیم بشه

sokanacademy forum
کاربر سکان آکادمی 5 سال پیش

بله دستتون درد نکنه درست شد ممنون از راهنمایی خوبتون

online-support-icon