I've been working on a simple java application, and wanted to add a logo as the homescreen is fairly empty. I tried using an image view, and after it didn't work I googled tutorials to make sure I was initiating it correctly. I didn't see any difference, but the actual image wouldn't load.
Xml code for image view:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src = "#drawable/logo"
android:layout_gravity="center"
android:contentDescription="#string/logo"
android:layout_below="#+id/textView"
android:layout_above="#+id/txtBody"
android:layout_alignRight="#+id/txtBody"
android:layout_alignEnd="#+id/txtBody"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:visibility="visible"
android:maxHeight="600dp"
android:maxWidth="600dp"
android:minHeight="100dp"
android:minWidth="100dp"
android:clickable="false" />
And here's a picture of the layout preview (With an arrow pointing to the outline of where it should be, and the resource circled in the correct folder) along with a picture of the logo
Any dice if you add
android:scaleType="fitCenter"
android:adjustViewBounds="true"
Edit: also are we sure nothing is overlapping it?
Related
I'm trying to make a rounded shape like this :
The code below works great on a device with 6.7" as screen size.
<com.google.android.material.card.MaterialCardView
android:id="#+id/resultHolder"
android:layout_width="232dp"
android:layout_height="376dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:gravity="center"
android:rotation="15"
android:outlineProvider="background"
android:theme="#style/Theme.MaterialComponents.Light"
app:cardBackgroundColor="#color/black"
app:cardCornerRadius="120dp"
app:cardElevation="0dp"
app:strokeColor="#color/green_neon"
app:strokeWidth="6dp">
<ImageView
android:src="#drawable/thumbnail"
android:id="#+id/resultImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:scaleType="centerCrop" />
</com.google.android.material.card.MaterialCardView>
But when I test the app on device with 5.1" as screen size. I get this :
You're setting
android:layout_width="232dp"
android:layout_height="376dp"
which are fixed values when you put app:cardCornerRadius="120dp" which is very high it does not get the space to complete it's 120dp radius on a smaller screen..
Use a background drawable or a different solution. This solution will work perfectly only in the 6.7 inch screen that you have and only that
I am using https://github.com/AleSpero/ExpandableCardView library to make an expendable card view. But i don't need the arrow placed in right side.
I also try to find for the attribute or method that can remove this but don't find any one. Please help me to solve this. I will be very grateful. Thanks in advance for your time.
card.setIcon(null);
but it remove only the left icon not the right icon.
Just add this lineandroid:groupIndicator="#null"
<ExpandableListView
android:id="#+id/ev_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="188dp"
android:background="#android:color/white"
android:dividerHeight="0dp"
android:groupIndicator="#null" />
On your MainActivity please use below code
val card : ImageButton = findViewById(R.id.card_arrow)
card.visibility=View.INVISIBL
or remove icon from this xml file expandable_cardview
<ImageButton
android:id="#+id/card_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:layout_alignParentEnd="true"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="#string/expandable_card_view_image_content_description"/>
I have a gif image as
However using glide i do this
Glide.with(this)
.load(Uri.parse("file:///android_asset/" + "stickers/" + emoji))
.into(gifImage);
What i get is
Exactly what is going on, I have tried GifImageView library too and result is same. How can i parse gif image properly in android?
after adding datasource
<ImageView
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:visibility="gone"
android:layout_height="100dp"
android:layout_width="100dp"
android:id="#+id/chateeGifImage"
/>
try like this
Glide.with(con).load(url).asGif().diskCacheStrategy(DiskCacheStrategy.SOURCE).into(ivImage);
I have imageview with resolution of 430x871 in folders xxhdpi, xhdpi and hdpi. But when I run app, on 5" Xperia Z (xxhdpi) screen it works normally (1. picture) but on 4.7" Amazon Phone (xhdpi) it's smaller (2. picture). Altough when I run it on Amazon Fire HD 8.9 or 7 or 6, (all xdpi) it works too...
How can I stretch in on that Amazon Phone?
Here is XML code of the Imageview:
<ImageView
android:id="#+id/matter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:gravity="center"
android:src="#drawable/matter"
/>
if aspect ratio is not important for you use:
android:scaleType="fitXY"
but if yes try this:
android:scaleType="fitCenter"
and also change this:
android:layout_height="match_parent"
There's a property called :
android:scaleType="fitXY"
inside ImageView tag.
how to make the content of the sliding drawer a little "stuck out" (hang out)?
After pull
You can't do it with the stock widget.
However, someone asked about this before and an answer was posted by someone who has made a class to allow you to do just that. Follow the answer link for instructions.
The code is here
Here is an example to do it within your XML file
<SlidingDrawer
android:id="#+id/drawer"
android:layout_width = "320dp" //set what ever dimensions you find appopriate
android:layout_height = "440dp"
android:orientation = "vertical"
android:handle="#+id/handle"
android:content="#+id/content">
<ImageView
android:id="#+id/handle"
android:layout_width="48dp" // Set your dimensions. This will be your handle
android:layout_height="48dp"
android:src="#drawable/putHandleImageHere" />
<TextView android:id="#+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text ="Hello World" />
---------------EDIT------------------
I reread your question and I see that your trying to have the content hang out. Try using
android:paddingTop="10dp"
or
android:layout_marginTop="10dp"
Let me know if that worked, good luck.