I want to create a transparent Activity that load when we open the application on top of another Activity exactly like this.
I want that picture to be clicked and then it open the browser to open the link integrated with this image
How can I achieve this?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/root"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#android:color/transparent"
android:orientation="vertical" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:padding="2dp"
android:background="#drawable/videobackground"
/>
</RelativeLayout>
Related
I currently developing a small app in android right now, and instead of using an image resource, I wanna use video as the background. Is this possible?
Use layout with videoview as background
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<VideoView
android:scrollbars="none"
android:clickable="false"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:fitsSystemWindows="true"
android:id="#+id/videoView"
/>
When I restore an Activity from memory, I have a preview window for a couple of seconds.(Android OS just place it before loading all GUI stuff). I need to place a logo of an app in this preview window (I coded this as layout.xml) or make some splash screen (but not at the start of activity, but when it's restored).
To make situation more clear:
I have a layout with picture:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="194dp"
android:layout_height="146dp"
android:src="#drawable/shell1" />
</RelativeLayout>
It looks like on this picture:
But, I can't use this layout for preview window. And if i use only image for preview window, I have something like that:
P.s. The second picture is not from preview window, it's just used to show the situation.
What should I do to have a proper nice look of preview window? To have this image just in the middle of screen. Thanks in advance.
This is for first Screen:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="194dp"
android:layout_height="146dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="#drawable/shell1" />
</RelativeLayout>
and this is for second Screen:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/shell1" />
</RelativeLayout>
try using-
<ImageView
android:id="#+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/shell1" />
instead of -
<ImageView
android:id="#+id/imageView1"
android:layout_width="194dp"
android:layout_height="146dp"
android:src="#drawable/shell1" />
I basically want to access my layout so that I can move onto the next screen when the user clicks anywhere on the present screen.
this is my xml code.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minWidth="25px"
android:minHeight="25px"
android:id="#+id/hellolayout">
<TextView
android:text="WELCOME!"
android:textSize="50dp"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.9"
android:id="#+id/textView1"
android:layout_centerHorizontal="true" />
<ImageView
android:src="#drawable/idiotic_smile"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.1"
android:id="#+id/imageView1" />
</LinearLayout>
In the class, 'hellolayout' is not recognized. Is there anything I'm missing to include?
LinearLayout l = FindViewById<LinearLayout> (Resource.Id.hellolayout);
Acessing a layout should be as simple as R.layout.YourLayoutName. To load it use setContentView(R.layout.YourLayoutName).
Better refer to the docs here.
I want to implement a splash screen for my app, i'm using this code to show the image, but the image is centered and not stretched to the whole screen. How can i solve that problem?
Thank you very much.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:src="#drawable/splash"
android:id="#+id/splash"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</ImageView>
</RelativeLayout>
Try
<ImageView android:id="#+id/splash" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:src="#drawable/splash"
android:scaleType="fitXY" />
Where android:scaleType="fitXY"is responsible for stretching the image.
I have made layout for custom dialog, it has inside two imageview. I want to show both Imageview when dialog appear. and i want to hide the main layout of my xml file I have used "#00000000" as background:color, but it is not working.
Is there any way to do the same?
Thanks.
Here is my layout. I have taken screen shot please have a look i want to hide the border which are showing in image.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:orientation="vertical" android:background="#00000000">
<LinearLayout android:id="#+id/linearLayout1"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
<ImageView android:id="#+id/img_closeimage" android:src="#drawable/product_zoom_close"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:clickable="true"></ImageView>
</LinearLayout>
<LinearLayout android:id="#+id/linearLayout2"
android:layout_marginLeft="25dip" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_marginTop="-5dip" android:layout_marginBottom="20dip" android:layout_marginRight="20dip">
<ImageView android:id="#+id/img_ProductZoom" android:src="#drawable/index"
android:layout_width="wrap_content" android:layout_height="wrap_content"
></ImageView>
</LinearLayout>
</LinearLayout>
image description here
Adinias comment is correct, your layout has quite some redundancy. You also say that you only want to show an imageview, but your layout contains two imageviews. If you only want to show one imageview, then your layout should look like this:
<?xml version="1.0" encoding="utf-8"?>
<ImageView android:id="#+id/img_ProductZoom" android:src="#drawable/index"
android:layout_width="wrap_content" android:layout_height="wrap_content"
/>
If you want to show two ImageViews, use this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:orientation="vertical" android:background="#00000000">
<ImageView android:id="#+id/img_closeimage" android:src="#drawable/product_zoom_close"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:clickable="true"/>
<ImageView android:id="#+id/img_ProductZoom" android:src="#drawable/index"
android:layout_width="wrap_content" android:layout_height="wrap_content"
/>
</LinearLayout>
Your current layout looks the way it does because you have specified the layout to take as much space as possible with android:layout_height="fill_parent" and android:layout_width="fill_parent". Try to use wrap_content as height and width instead.