Baixe o app para aproveitar ainda mais
Prévia do material em texto
1 Copie e cole a imagem para dentro da pasta res/drawable do seu projeto. 2 Problemas com o nome do arquivo: Nome do arquivo inválido, somente use [a-z0-9_.] 3 Se o arquivo estiver dentro da pasta, mas não está visível para o projeto, recompile limpando os binários. 4 Insira um ImageView dentro do seu layout, click duas vezes no widget para abrir a caixa de diálogo e escolher a imagem. 5 Você pode usar o ScaleType do atributo do ImageView 6 Outras alterações nas propriedades do ImageView <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="98dp" android:layout_marginTop="58dp" android:src="@drawable/eduardkosmack" /> <ImageView android:id="@+id/imageView1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:src="@drawable/eduardkosmack" /> 7 Atributos de borda <ImageView android:id="@+id/imageView1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:adjustViewBounds="true" android:scaleType="fitXY" android:src="@drawable/eduardkosmack" /> 8 OK 9 Crie uma nova activity, a que será chamada após o splash 10 Observe o arquivo AndroidManifest, identifique a nova activity adicionada. 11 Você pode adicionar um filtro a sua intent 12 Use a thread e o sleep para aguardar o splash. Em seguida use o método run para chamar a sua próxima Activity 13 Exercício • Crie uma tela de splash condizente ao seu projeto. • Baixe uma logo ou Imagem da internet Android ImageView and Splash Screen After copying an image file (Ctrl-c or right click copy), right click and paste it into one of the res/drawable folders of your project Problems with the file name: Invalid file name: must contain only [a-z0-9_.] Android is very sensitive about names If a file is in the folder but not visible in the package explorer, then go to Project/Clean After dragging an ImageView widget onto the layout, a dialog box appears, click on image name and OK (or double click on image name) Experiment with the ScaleType attribute Some changes to the ImageView attributes Add attributes to ImageView OK Add a new activity: right click on package New/Other Go to the AndroidManifest, switch the xml view tab Add an intent-filter for the new activity Use Thread and sleep to wait on splash screen before moving to new activity Slide 14
Compartilhar