Absolute Layout soll auf jedem Gerät gleich aussehen

Alph0r

Mitglied
Hi, ich programmier seit eniger Zeit an einem kleinen Spiel für Android und möchte im Menu Buttons an eine bestimmte Stelle positionieren. Das relative Layout ist mir zu ungenau und das Absolute sieht zumindest, wenn ich es einfach mit Pixeln einstelle, nicht auf jedem Handy gleich aus.

Gibt es eine möglichkeit meine Buttons genau dort zu haben, wo ich sie möchte und dass es trotzdem auf jedem Handy gleich aussieht?
 
M

Marcinek

Gast
Hi,

da viele Geräte unterschiedliche Auflösungen haben, wirst du nicht weit mit einem absoluten Layout kommen. Du kannst aber vorher schauen, wieviel platz du hast und dann eine propotionale Ansicht erstellen.

Wenn du davon ausgehst, dass du eine auflösung von 800x600 hast und dann bekommst du ein Gerät mit 400x300 dann ist das die Hälfte. Und dann machst du überall * 0,5 wo du eine Posi hast.

ICh programiere keine mobilen Anwendungen aber so könnte ich es mir vorstellen.

Gruß,

Martin
 

Alph0r

Mitglied
So sollte es im Optimalfall aussehen:

tSmXq.png


Das Problem am GridLayout ist für mich, dass es den ganzen Bildschirm einnnimmt und wenn ich da nur 2 Buttons reinmache und alles über dips mache, dann habe ich ja wieder dips drin und das sieht auf jedem Screen anders aus.

Der Weg von Marcinek klingt gut, so mache ich es auch in meiner View, aber in xml kann man scheinbar keine Screensize abfragen und ich kann die Buttons scheinbar auch nicht in Java code verschieben.

Ich kanns echt nciht verstehen, man kann die Höhe und Breite in Java Code ändern, aber nicht die Koordinaten.
 
Zuletzt bearbeitet:
Ähnliche Java Themen
  Titel Forum Antworten Datum
B Android Absolute kml-Datei erzeugen Android & Cross-Platform Mobile Apps 2
G Absolute Anfängerfrage bezüglich Eclipse Android & Cross-Platform Mobile Apps 9
W Ausklappbares Verlängertes XML Layout Android & Cross-Platform Mobile Apps 6
W Android Wieso kann ich keine ListView mehr zum Layout hinzufügen? Android & Cross-Platform Mobile Apps 1
A Android-Studio: 2. Layout nach kurzer Zeit aufzeigen Android & Cross-Platform Mobile Apps 2
S Android Layout - welchen Typ? Android & Cross-Platform Mobile Apps 3
B Android Multiple Screens- layout-sw600dp Android & Cross-Platform Mobile Apps 1
D Android Layout für alle Geräte Android & Cross-Platform Mobile Apps 4
W Android Designfrage / Layout / Activity / Fragments Android & Cross-Platform Mobile Apps 2
B Layout Bibliothek Android & Cross-Platform Mobile Apps 8
B Android Spiele-Layout umsetzen Android & Cross-Platform Mobile Apps 5
O zurück Schaltfläche in voriges Layout Android & Cross-Platform Mobile Apps 5
B Erste Android-App: setContentView(R.layout.main) funktioniert nicht Android & Cross-Platform Mobile Apps 6
D Android Viele Buttons und ein Layout Android & Cross-Platform Mobile Apps 6
M Android Game, welche Layout? Android & Cross-Platform Mobile Apps 2
B Eigene View xml-Layout einbinden Android & Cross-Platform Mobile Apps 1
R Android Layout Bild mit Text Android & Cross-Platform Mobile Apps 13
K Rand bei (Table,Relative,Linear)Layout - wie bekomme ich ihn weg? Android & Cross-Platform Mobile Apps 3
D Android Layout Problem Android & Cross-Platform Mobile Apps 2
P Android Nach Animation Layout auf alten Platz Android & Cross-Platform Mobile Apps 3
T Android Layout Update Animation Android & Cross-Platform Mobile Apps 3
P Probleme mit xml-Layout Android & Cross-Platform Mobile Apps 2
W XML Layout: wann wird geladen? Android & Cross-Platform Mobile Apps 10
F Layout mit listViews (Scrolling-Probleme) Android & Cross-Platform Mobile Apps 2
G Fehlermeldung: "No XML content. Please add a root view or layout to your documet." Android & Cross-Platform Mobile Apps 7
N Android xml - graphical layout nur noch weiß :o Android & Cross-Platform Mobile Apps 4
T Android Merkwürdigkeiten im Layout Android & Cross-Platform Mobile Apps 7
JAVAnnik Android Layout ändern in Thread Android & Cross-Platform Mobile Apps 2
A Android Browser öffnen, XML-GUI-Layout Android & Cross-Platform Mobile Apps 23
S Android Layout Problem mit fill_parent Android & Cross-Platform Mobile Apps 5
tfa Android Layout-Probleme: View programmatisch erweitern (addContentView) Android & Cross-Platform Mobile Apps 7
I Android ListView (Custom) soll auf Hardwaretasten nicht reagieren. Android & Cross-Platform Mobile Apps 10
J Was soll das bedeuten ? does not require android.permission.BIND_JOB_SERVICE permission Android & Cross-Platform Mobile Apps 7
D Wie soll ich anfangen (GWT Mobile, Phone Gap)? Android & Cross-Platform Mobile Apps 3

Ähnliche Java Themen

Neue Themen


Oben