| |||||||
Das Thema "View programmatisch auf LinearLayout setzen und LowLevel Grafik zeichnen" befindet sich unter Android App Entwicklung auf Android-Hilfe.de.
|
| | Themen-Optionen | Ansicht |
| | #1 (permalink) |
| Neuer Benutzer Registriert seit: 30.11.2011
Beiträge: 1
Abgegebene Danke: 0
Erhielt 0 Danke für 0 Beiträge
| ich habe eine View welche Low Level Grafiken zeichnet u. A. Rechtecke usw. dieses habe ich in ein geschachteltes LinearLayout gesetzt. Es wird zwar gezeichnet jedoch nicht innerhalb seines gültigen LinearLayout Bereiches. Das äussert sich dadurch das die Grafik scheinbar am Screen Kopfende gezeichnet wird. Kurz Struktur: LinearLayout -> LinearLayout ---> Meine Grafik Code: //LayoutParams
LayoutParams mainLayoutParams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
LayoutParams subLayoutParams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
LinearLayout mainLayout = new LinearLayout(this);
mainLayout.setOrientation(LinearLayout.VERTICAL);
mainLayout.setLayoutParams(mainLayoutParams);
mainLayout.setBackgroundColor(android.graphics.Color.BLUE);
LinearLayout subLayout = new LinearLayout(this);
subLayout.setLayoutParams(subLayoutParams);
subLayout.setOrientation(LinearLayout.VERTICAL);
subLayout.setBackgroundColor(android.graphics.Color.YELLOW);
TextView textView = new TextView(this);
textView.setText("TEST TEST MainLayout");
TextView textView2 = new TextView(this);
textView2.setText("TEST TEST SubLayout");
mainLayout.addView(textView);
subLayout.addView(textView2);
androidBean = new AndroidBean(subLayout.getContext(),drawing);
subLayout.addView(grinxBean);
mainLayout.addView(subLayout);
this.setContentView(mainLayout); ![]() Also die Rechteck Geschichte sollte erst im SubLayout gezeichnet werden, d.h. hier geht wohl irgendwas schief. Der LayoutManager sollte der Bean eigentlich sagen wo er loslegen kann, so wie das ganze auch in Swing funktioniert. Danke für alle Tipps, suche hier schon ne Weile nach der Ursache Geändert von TesterAndroid (30.11.2011 um 11:51 Uhr) |
| | |
![]() |
|
| Themen-Optionen | |
| Ansicht | |
| |
| ||||
| Thema | Autor | Forum | Antworten | Letzter Beitrag |
| Zeichnen auf Canvas | soma-web | Android App Entwicklung | 7 | 29.07.2011 17:19 |
| linearlayout buttons und gravity | ping87 | Android App Entwicklung | 3 | 30.09.2010 15:06 |
| Android Views zeichnen auf SurfaceView | Makaveli | Android App Entwicklung | 4 | 10.09.2010 23:08 |
| TableLayout und LinearLayout mischen möglich ? | RED-BARON | Android App Entwicklung | 1 | 05.11.2009 15:18 |