תחומים
    • הרשמה
    • התחברות
    • חיפוש
    • קטגוריות
    • פוסטים אחרונים
    • משתמשים
    • חיפוש
    חוקי הפורום

    vertical ב-activity_main.xml לא עובד כמצופה

    תכנות
    2
    3
    77
    טוען פוסטים נוספים
    • מהישן לחדש
    • מהחדש לישן
    • הכי הרבה הצבעות
    תגובה
    • הגב כנושא
    התחבר בכדי לפרסם תגובה
    נושא זה נמחק. רק משתמשים עם הרשאות מתאימות יוכלו לצפות בו.
    • Y
      yyy נערך לאחרונה על ידי

      צהרים טובים!
      שאלה של מתחיל בפיתוח לאנדרואיד:
      אני מנסה למקם LinearLayout בעל orientation של vertical, כאשר בתוכו יש כמה LinearLayout כאשר הם בעלי orientation של horizontal, בכדי להגיע לתצוגה טבלאית.
      בפועל באפליקציה מוצג לי רק ה-LinearLayout העליון
      מדוע זה קורה?
      תודה רבה - מצו"ב קוד לדוגמא

      <?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"
          android:orientation="vertical"><--------------------------
      
          <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"
              android:orientation="horizontal"><--------------------------
      
              <TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Hello World!" />
              <TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Hello World!" />
              <TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Hello World!" />
      
          </LinearLayout>
          <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"
              android:orientation="horizontal"><--------------------------
      
              <TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Hello World!" />
              <TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Hello World!" />
              <TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Hello World!" />
      
          </LinearLayout>
          <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"
              android:orientation="horizontal"><--------------------------
      
              <TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Hello World!" />
              <TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Hello World!" />
              <TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Hello World!" />
      
          </LinearLayout>
      
      
      </LinearLayout>
      
      OdedDvir תגובה 1 תגובה אחרונה תגובה ציטוט 0
      • OdedDvir
        OdedDvir @yyy נערך לאחרונה על ידי OdedDvir

        @yyy סתם שאלת תם 🤔 : (בתור מי שעדיין לא התחיל בכלל בפיתוח לאנדרואיד...)
        למה שלא תשתמש ב TableLayout שמיועד לטבלאות? יש כאן דוגמא

        Y תגובה 1 תגובה אחרונה תגובה ציטוט 0
        • Y
          yyy @OdedDvir נערך לאחרונה על ידי

          @odeddvir כי לא לכל דבר מתאימה טבלה.
          בכ"א הפתרון הוא לשנות את

          android:layout_height="match_parent"
          

          ל-

          android:layout_height="wrap_content"
          
          תגובה 1 תגובה אחרונה תגובה ציטוט 1
          • הועבר מ תכנות ע"י  dovid dovid 
          • 1 / 1
          • פוסט ראשון
            פוסט אחרון
          בא תתחבר לדף היומי!