[บทเรียน,B4A] ตรวจสอบหน้าจอ แนวตั้ง หรือ แนวนอน

Theera

Well-Known Member
Licensed User
Longtime User
B4X:
    If GetDeviceLayoutValues.Width > GetDeviceLayoutValues.Height Then
            Orientation = "Landscape"  'แนวนอน
    Else
            Orientation = "Portrait" 'แนวตั้ง
    End If

เราสามารถกำหนดค่า ในไฟล์ manifest ได้ดังนี้ ถ้าต้องการกำหนดเจาะจงลงไป นอกเหนือจากวิธีตั้งค่าในส่วน Project Attribute ใน IDE
B4X:
     SetActivityAttribute(MyActivityName, android:screenOrientation, "landscape")
 
Last edited:
Top