nine-patch

Change Nine Patch image color at runtime android

泪湿孤枕 提交于 2019-12-11 07:59:02
问题 Good day.I want to change the actual 9 patch png image color during the runtime.The reason i need,is that i want to let user customize the actual color of image.My 9 patch image is an chat bubble.Simple DrawableTintCompat is not working as it is tinting the whole background except actual bubble.What i want is something like tinting,where the color of that bubble will be changed in 9 patch,so any of you guys have encounter such thing?Can you please give me an heads up? 回答1: Ok i have managed

Android Fragments API doesn't show background 9patch image correctly

梦想与她 提交于 2019-12-11 03:37:20
问题 I'm porting an existing android app to honeycomb and the fragments API and compatibility library. I'm using the same layout, but I'm loading it into a fragment. The background is a 9patch image, but it now only covers the top left quarter of the screen. The rest of the background is white. If I change the background to a hex color, it covers the entire screen. This has never happened before switching to fragments and the layout did not change. I'm somewhat new to Android and very new to

How to set 9-patch background for ViewPager, that will put the pages inside, and keep aspect ratio?

夙愿已清 提交于 2019-12-11 03:25:20
问题 Background I have a ViewPager (of images pages), which needs to show its content inside an image that should keep its aspect ratio. The problem Problem is, when I just set a 9-patch for any kind of ViewGroup (including the ViewPager), the image just stretches (not keeping the aspect-ratio), and for some reason, it doesn't even respect the content bounding box I've set to it (in the 9-patch). It occurs even if I put the ViewPager in a FrameLayout that has the 9-patch background instead. What I

How to right align in linear layout

不羁岁月 提交于 2019-12-10 19:54:15
问题 I have this layout as my list items: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:gravity="center_vertical" android:layout_width="match_parent" android:orientation="horizontal" android:minHeight="42.3dp" android:layout_height="wrap_content"> <TextView android:id="@+id/txtTagName" android:textColor="@color/White" android:layout_width="wrap_content" android:layout_height="32dp" android:layout_marginLeft="10dp" android

Why nine-patch image in RelativeLayour hides all inner elements?

半城伤御伤魂 提交于 2019-12-10 19:39:26
问题 When I set 9.PNG image as RelativeLayout 's background, all elements inside it gets shrunken to the middle. Here is the XML and the snapshot. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/bg" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Just a simple white text which does not show up" android:textColor="#ffffff"

Transparent 9patch image: line showing through

爱⌒轻易说出口 提交于 2019-12-10 16:09:14
问题 I got a transparant 9patch image which has the 9patch lines showing trough. This is the output: Obviously I don't want the horizontal lines to be visible. This is how I created the 9patch: This is the final image that is used in the application: AFAIK the 9patch is correct. What do I need to change in order for the horizontal lines to disappear? 回答1: The unwanted lines come from the fixed (non-stretched) parts of the ninepatch overlapping. This is happening because you are drawing it at a

Android Nine-patch equivalent for other platforms

本小妞迷上赌 提交于 2019-12-10 13:24:39
问题 I have just learned about Android nine-patches idea, and it is a pretty good idea. My question is if it is an Android pattern or there is implementations like that for other platforms, probably differently named. Thanks! 回答1: In iOS you can also strech images in code with StretchableImages. You specify the left, right caps and the "rest" is stretched. I think is basicaly the same idea, this is something like a tutorial on it: http://blog.chomperstomp.com/creating-dynamically-re-sizable

Can't apply a colorFilter to text selection handles

守給你的承諾、 提交于 2019-12-10 11:08:42
问题 I'm trying to bring material text selection handles to my app. I got drawables from the SDK for middle/right/left handle (bitmaps) and text cursor (9-patch), and set: <item name="android:textSelectHandleLeft">@drawable/text_select_handle_left_mtrl_alpha</item> <item name="android:textSelectHandleRight">@drawable/text_select_handle_right_mtrl_alpha</item> <item name="android:textSelectHandle">@drawable/text_select_handle_middle_mtrl_alpha</item> <item name="android:textCursorDrawable">

Nine-patch versus Vector graphics

主宰稳场 提交于 2019-12-09 09:46:48
问题 I am learning about Android UI and am unclear why people use nine-patch, when you could use vector graphics, because those are scalable without any pixel degradation. I am a beginner in Android, so I hope I am not missing anything here, but it seems like it would be easier to build vector graphics and use those. You would not need the special editor to build them. Can anyone explain the advantages to using nine-patch over vector? (Don't just explain advantages of nine-patch, as that is

Android : Alignment bug in making/showing 9patch image

半城伤御伤魂 提交于 2019-12-08 14:48:49
问题 NinePatch: Screenshot: Layout XML: <?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" android:orientation="vertical" android:background="#ffffff"> <LinearLayout android:id="@+id/edit_tray" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true"> <View android:layout_width="fill_parent" android:layout