In my activity I try to make it transparent and with a 9 patch corner design , but it still showing a black color at the corner there, anyone know how to get rid of it ?
What I try to do here is Non transparent (normal) Activity A with start a new transparent activity B as shown as below image but the 9patch background with corner design not fully transparent.
Here's my 9patch
Activity XML
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="#00000000"
android:fadingEdge ="horizontal"
android:dividerHeight="0dp"
android:background="#drawable/orange9patch">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:isScrollContainer="true"
android:scrollbars="vertical"
android:padding="12dip" >
[...........]
Manifest
<activity android:name=".ui.ResultActivity"
android:theme="#style/Theme.Transparent">
</activity>
Style
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
[..........]
use <style name="Theme.Transparent" parent="android:style/Theme.Translucent">
instead of yours.
Related
I've tried adding and substracting a lot of stuff but whenever my splash screen gets launched there is always a round corner or a type of elevation in the image.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#3c3734"
tools:context="com.example.akshay.athleticgo.SplashScreen">
<ImageView
android:id="#+id/splash_logo"
android:adjustViewBounds="true"
android:elevation="0dp"
android:fitsSystemWindows="true"
android:background="#3c3734"
android:src="#mipmap/ath_splash"
android:layout_height="match_parent"
android:layout_width="match_parent"/>
</FrameLayout>
and this is my style am using
<style name="Theme.Transparent" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowIsTranslucent">true</item>
</style>
As you are using image from mipmap folder and mipmap is only for launcher icons. Most of the cases launcher icon has gradient border/shadow. I think your image has this gradient border. Check your image first.
Best practice is to put image resource files into drawable folder and use(android:src="#drawable/ath_splash") it into views as per your needs.
I have layout with centered Image View.
<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#color/WHITE">
<ImageView
android:id="#+id/powered_by"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#drawable/powered_by" />
<ImageView
android:id="#+id/splash_logo"
android:src="#drawable/logo"
app:layout_widthPercent="70%"
app:layout_heightPercent="70%"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:adjustViewBounds="true"
android:visibility="invisible" />
</android.support.percent.PercentRelativeLayout>
Here is theme setting for my activity
<style name="SplashTheme" parent="android:Theme.Holo.Light">
<item name="android:windowBackground">#drawable/splash</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
</style>
When i change parent theme to android:Theme.DeviceDefault.Light, ImageView appears a little bit higher, not in center of the screen. It seems like parent view for my device now starts not from the bottom of the screen, but from the bottom toolbar (i use Nexus 5X with on-screen buttons).
I want to use device default theme for a modern dialog appearance, but i also need to have this image view exactly in center on all devices.
How to do it?
It seems like android:Theme.DeviceDefault.Light is not setting android:windowFullScreen. So you will need to create your own theme with the parent android:Theme.DeviceDefault.Light and change the values for the items you want to change
<style name="TestTheme" parent="android:Theme.DeviceDefault.Light">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
</style>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:background="#drawable/ic_shade"
android:layout_height="match_parent" >
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center"
android:textSize="54sp"
android:layout_centerVertical="true"
android:textColor="#android:color/white"
android:text="مبروك \nلقد ربحت كوبون"/>
</RelativeLayout>
What happens, it doesnt take entire width/height and i dont see the background on entire page.I am using the activity to be transparent.
Below is code for activity, however if i add
< item name="android:windowFullscreen ">true</item>
to the below part it works.. but i dont want it to do it because its resizing my previous activity.
<style name="Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
<!-- Application t
your textview is filling the whole screen, change layout_height and layout_width attributes of your text view to wrap_content. then textview will be in center and background will appear on entire screen
I want to use an Activity which has normal views and controls.
I made the background of it as an image and I can't make this image transparent
Here's my code :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/honey"
>
</RelativeLayout>
I want just the image to be transparent
try this for transparent background:
in the file AndroidManifest.xml
<activity android:name="YourActivity" android:theme="#style/TransparentStyle"></activity>
in the file /res/values/style.xml
<resources>
<style name="TransparentStyle">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">#android:style/Animation.Translucent</item>
<item name ="android:windowBackground">#00000000</item>
<item name="android:windowNoTitle">true</item>
<item name="android:colorForeground">#ffffff</item>
</style>
</resources>
and try this for transparent image:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/yourImage"
android:alpha=".75"/>
I'm developing for api 15. I have a layout with a background image and a button. When the button is pressed background image should change alpha to 150. But it isn't taking effect. Do I have to somehow force update on layout so that it does take effect?
Here is my xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/wall1Layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/wall1withkey"
tools:context=".FireRoomActivity" >
<Button ...
/>
</RelativeLayout>
And in main activity there is a method that supposed to respond to onClick from the button:
public void buttonClicked(View v)
{
findViewById(R.id.wall1Layout).getBackground().setAlpha(180);;
}
So the image wall1withkey should change alpha to 180
When i tried to create translucent background i used my own custom Theme.
styles.xml
<style name="Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
Then you have to set this Theme.Transparent to your activity in AndroidManifest.xml
<activity
android:name="com.example.TransparentActivity"
android:theme="#style/Theme.Transparent" >
</activity>