Hintergrund verlauf

  • Antworten:24
Mac Systems
  • Forum-Beiträge: 1.727

16.02.2010, 13:06:47 via Website

Was ist der beste Ansatz einen Farbverlauf als Hintergrund eines Screens zu bekommen ? thx,
Mac

Windmate HD, See you @ IO 14 , Worked on Wundercar, Glass V3, LG G Watch, Moto 360, Android TV

Antworten
Hans Nosch
  • Forum-Beiträge: 65

16.02.2010, 13:14:17 via Website

ich würd sagen am einfachsten ist Farbverlauf malen und als Hintergrund anzeigen lassen.

Es geht sicher auch viel eleganter über Vertices-Farben. Doch schneller vermutlich nicht. Außerdem hat man den Verlauf dann nicht mehr im Griff (Zwischenfarben zB)

Antworten
Mac Systems
  • Forum-Beiträge: 1.727

16.02.2010, 13:33:01 via Website

Bei Vertices meinst du GL ES ?
Ich hab einfach so meine bedenken feste Bilder zu verwenden dafür, mach bei den ganzen Devices irgendwie nicht so den Sinn.
Oder Ich zeichne den Hintergrund in ein Image selbst.

Hmm,
Mac

Windmate HD, See you @ IO 14 , Worked on Wundercar, Glass V3, LG G Watch, Moto 360, Android TV

Antworten
Jack-In-Da-Box
  • Forum-Beiträge: 1.569

16.02.2010, 14:26:11 via Website

meinst du sowas?



hab das einfach mit einer "drawable/mygradient.xml" bewerkstelligt.

1<?xml version="1.0" encoding="utf-8"?>
2<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
3 <gradient
4 android:startColor="#66FFFFFF"
5 android:endColor="#FFFFFFFF"
6 android:angle="270"/>
7</shape>

1<?xml version="1.0" encoding="utf-8"?>
2<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
3 <gradient
4 android:startColor="#FF0000"
5 android:endColor="#0000FF"
6 android:angle="180"/>
7</shape>

die kannst du dann beliebig verwenden.

— geändert am 16.02.2010, 14:37:23

Ka Li

Antworten
Markus Gu
  • Forum-Beiträge: 2.644

16.02.2010, 15:13:23 via Website

warum macht feste bilder keinen sinn??

guck dir mal 9 pitch grafiken an, damit kannst sie automatisch skalieren

swordiApps Blog - Website

Antworten
Mac Systems
  • Forum-Beiträge: 1.727

16.02.2010, 15:30:30 via Website

@Jack: Ja, so was meine Ich. :lol:

Wusste doch das da was war. Bildchen deshalb nicht, da es eher Käse aussieht, denke das hier mittels Shape das Resultat besser ist.

PS: Da ende ist in Sicht.

Windmate HD, See you @ IO 14 , Worked on Wundercar, Glass V3, LG G Watch, Moto 360, Android TV

Antworten
Mac Systems
  • Forum-Beiträge: 1.727

16.02.2010, 16:25:07 via Website

Hab das Bsp. von JAck mal benutzt, sehe allerdings recht wenig, gerade bisschen dazu gegoogelt, ohne nennenswerten Erfolg. Wo ist mein Denkfehler ?

1<?xml version="1.0" encoding="utf-8"?>
2<LinearLayout
3 xmlns:android="http://schemas.android.com/apk/res/android"
4 android:layout_width="wrap_content"
5 android:layout_height="wrap_content"
6 android:background="@drawable/gradientbackground">
7 <TableLayout
8 xmlns:android="http://schemas.android.com/apk/res/android"
9 android:layout_width="fill_parent"
10 android:layout_height="fill_parent"
11 android:stretchColumns="1*">
12 <TableRow>
13 <TextView
14 android:text="Datum" />
15 <TextView
16 android:text="20" />
17 <TextView
18 android:text="20" />
19 <TextView
20 android:text="20" />
21 <TextView
22 android:text="20" />
23 <TextView
24 android:text="21" />
25 <TextView
26 android:text="21" />
27 <TextView
28 android:text="21" />
29
30 </TableRow>
31 <TableRow>
32 <TextView
33 android:text="Uhrzeit" />
34 <TextView
35 android:text="08" />
36 <TextView
37 android:text="11" />
38 <TextView
39 android:text="15" />
40 <TextView
41 android:text="17" />
42 <TextView
43 android:text="08" />
44 <TextView
45 android:text="11" />
46 <TextView
47 android:text="15" />
48
49 </TableRow>
50
51 </TableLayout>
52</LinearLayout>

Windmate HD, See you @ IO 14 , Worked on Wundercar, Glass V3, LG G Watch, Moto 360, Android TV

Antworten
Jack-In-Da-Box
  • Forum-Beiträge: 1.569

16.02.2010, 16:48:49 via Website

Keine Ahnung wo Dein Denkfehler ist... hmmm... Ich hab nicht direkt den Background des
"LinearLayout" angesprochen, sondern ein "ImageView" benutzt.

Versuch doch mal, ob das Beispiel bei Dir klappt... Dann liegt es vielleicht daran... Wobei
ich das etwas komisch fände.


Main.java
1package com.userscreen.android.testapp;
2
3/* ==================================================================================== */
4
5import android.app.Activity;
6import android.os.Bundle;
7import android.widget.ImageView;
8
9/* #################################################################################### */
10/* public class Main extends Activity
11/* #################################################################################### */
12public class Main extends Activity {
13
14 /* ================================================================================ */
15 /* DECLARES
16 /* ================================================================================ */
17 ImageView ivBackground;
18
19 /* ================================================================================ */
20 /* public void onCreate(Bundle savedInstanceState)
21 /* ================================================================================ */
22 @Override
23 public void onCreate(Bundle savedInstanceState) {
24
25 super.onCreate(savedInstanceState);
26 setContentView(R.layout.main);
27
28 ivBackground = (ImageView) findViewById(R.id.Background);
29 ivBackground.setImageResource(R.drawable.mygradient);
30
31 }
32 /* ================================================================================ */
33
34}
35/* #################################################################################### */

/layout/main.xml
1<?xml version="1.0" encoding="utf-8"?>
2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:orientation="vertical"
4 android:layout_width="fill_parent"
5 android:layout_height="fill_parent"
6 >
7
8 <ImageView android:id="@+id/Background"
9 android:layout_width="fill_parent"
10 android:layout_height="fill_parent"
11 android:scaleType="fitXY">
12 </ImageView>
13
14</LinearLayout>

/drawable/mygradient.xml
1<?xml version="1.0" encoding="utf-8"?>
2<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
3 <gradient
4 android:startColor="#FF0000"
5 android:endColor="#0000FF"
6 android:angle="180"/>
7</shape>

Antworten
Jack-In-Da-Box
  • Forum-Beiträge: 1.569

16.02.2010, 17:01:20 via Website

Also bei mir funzt das mit Deiner Tabelle...

1<?xml version="1.0" encoding="utf-8"?>
2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:orientation="vertical"
4 android:layout_width="fill_parent"
5 android:layout_height="fill_parent"
6 android:background="@drawable/mygradient"
7 >
8
9 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
10 android:layout_width="fill_parent"
11 android:layout_height="fill_parent"
12 android:stretchColumns="1*"
13 >
14 <TableRow>
15 <TextView
16 android:text="Datum" />
17 <TextView
18 android:text="20" />
19 <TextView
20 android:text="20" />
21 <TextView
22 android:text="20" />
23 <TextView
24 android:text="20" />
25 <TextView
26 android:text="21" />
27 <TextView
28 android:text="21" />
29 <TextView
30 android:text="21" />
31 </TableRow>
32 <TableRow>
33 <TextView
34 android:text="Uhrzeit" />
35 <TextView
36 android:text="08" />
37 <TextView
38 android:text="11" />
39 <TextView
40 android:text="15" />
41 <TextView
42 android:text="17" />
43 <TextView
44 android:text="08" />
45 <TextView
46 android:text="11" />
47 <TextView
48 android:text="15" />
49 </TableRow>
50 </TableLayout>
51
52</LinearLayout>


Antworten
Mac Systems
  • Forum-Beiträge: 1.727

16.02.2010, 17:20:07 via Website

Welches SDK benutzt du ? Nutzte meist noch das 1.5er. Hab gerade mal auf 2.01 umgestellt, ohne Erfolg, selbst nach Eclipse Neustart. Quellcode kopiert, nix :/

PS: Bilder einfügen ist hier aber kompliziert gelöst, oder ich bin zu dumm.

— geändert am 16.02.2010, 17:20:27

Windmate HD, See you @ IO 14 , Worked on Wundercar, Glass V3, LG G Watch, Moto 360, Android TV

Antworten
Mac Systems
  • Forum-Beiträge: 1.727

16.02.2010, 17:26:44 via Website

Lol, der dämliche Editor zeigt es nur nicht an. Toll! *fuchtel*

Windmate HD, See you @ IO 14 , Worked on Wundercar, Glass V3, LG G Watch, Moto 360, Android TV

Antworten
Jack-In-Da-Box
  • Forum-Beiträge: 1.569

16.02.2010, 17:27:50 via Website

Hatte das Beispiel in 1.6 geschrieben... aber extra für DICH nochmal mit 1.5 getestet... läuft :bashful:

Was ist genau kompliziert mit "Bilder einfügen"? Es gibt meistens mehrere Wege zum Ziel...

hast du die "gradientbackground.xml" in dem "/drawable" ordner abgelegt?
und heisst die auch wirklich so?

obwohl... blödsinn... sonst gäbe es ja ne fehlermeldung... hmmm

Antworten
Jack-In-Da-Box
  • Forum-Beiträge: 1.569

16.02.2010, 17:28:26 via Website

Mac Systems
Lol, der dämliche Editor zeigt es nur nicht an. Toll! *fuchtel*

hä? *g*

Antworten
Mac Systems
  • Forum-Beiträge: 1.727

16.02.2010, 17:30:28 via Website

Liegt im drawable Ordner, richtig, da ist Android stark, sonst würde er meckern. Nur zeigt er es nicht im Vorschaufenster an, was ich jetzt die ganze Zeit erwartet hätte.
Hab hab nicht gerade Lust ständig irgendwas zu starten nur um es zu sehen.

Windmate HD, See you @ IO 14 , Worked on Wundercar, Glass V3, LG G Watch, Moto 360, Android TV

Antworten
Jack-In-Da-Box
  • Forum-Beiträge: 1.569

16.02.2010, 17:31:19 via Website

lol achso... ja musste schon im emulator starten ;-)

Antworten
Mac Systems
  • Forum-Beiträge: 1.727

16.02.2010, 17:32:36 via Website

Zu dem Bildeinfügen Problem, ein Alert Dialog sagt mir:

Du hast folgende Datei ausgewählt:

https://fscl01.fonpit.de/userfiles/161377/image/Bildschirmfoto.png

Was soll Ich damit machen ?

- mac

Windmate HD, See you @ IO 14 , Worked on Wundercar, Glass V3, LG G Watch, Moto 360, Android TV

Antworten
Jack-In-Da-Box
  • Forum-Beiträge: 1.569

16.02.2010, 17:34:58 via Website

kopieren... dann im texteditor "bild einfügen"... link einfügen... ok drücken
dann sollte das zwischen [ img] tags im texteditor auftauchen...

sieht dann etwa so aus (ohne punkt):
[.img]https://fscl01.fonpit.de/userfiles/161377/image/Bildschirmfoto.png[./img]

und wenn du vorschau oder speichern drückst/klickst, wird das bild angezeigt.

— geändert am 16.02.2010, 17:39:25

Antworten
Mac Systems
  • Forum-Beiträge: 1.727

16.02.2010, 17:41:22 via Website

Lol, wer hat sich das einfallen lassen ?

Windmate HD, See you @ IO 14 , Worked on Wundercar, Glass V3, LG G Watch, Moto 360, Android TV

Antworten
Jack-In-Da-Box
  • Forum-Beiträge: 1.569

16.02.2010, 17:41:50 via Website

Mac Systems
Lol, wer hat sich das einfallen lassen ?

sven (denke ich mal)

Antworten
Mac Systems
  • Forum-Beiträge: 1.727

16.02.2010, 17:44:50 via Website

Usability: 6!

Windmate HD, See you @ IO 14 , Worked on Wundercar, Glass V3, LG G Watch, Moto 360, Android TV

Antworten
Jack-In-Da-Box
  • Forum-Beiträge: 1.569

16.02.2010, 17:48:07 via Website

lol... naja, mit ein wenig übung gehts... besser als gar keine möglichkeit
um bilder einzufügen... so kann man externe (fremde server) und eigene
bilder (im userordner via datei-browser) anzeigen lassen...

Antworten
Gelöschter Account
  • Forum-Beiträge: 190

16.02.2010, 18:37:11 via App

??
versteh euer prob, net...
is do n standard aufruf?

Antworten
Jack-In-Da-Box
  • Forum-Beiträge: 1.569

16.02.2010, 18:49:50 via Website

Johannes H.
versteh euer prob, net...


gibt kein problem... genau genommen hat es nie eines gegeben *g*


Mac Systems
Lol, der dämliche Editor zeigt es nur nicht an. Toll! *fuchtel*

Jack-In-Da-Box
lol achso... ja musste schon im emulator starten

Antworten
Mac Systems
  • Forum-Beiträge: 1.727

16.02.2010, 21:51:37 via Website

Gut das wir drüber geredet haben.

n8,
Mac

Windmate HD, See you @ IO 14 , Worked on Wundercar, Glass V3, LG G Watch, Moto 360, Android TV

Antworten