android-custom-view

Setting textSize in custom view results in huge text

╄→гoц情女王★ 提交于 2019-12-20 11:00:08
问题 I'm calling the following in the constructor of my custom view: private void style(Resources.Theme theme, AttributeSet attrs) { TypedArray a = theme.obtainStyledAttributes( attrs, R.styleable.StackedTextView, 0, 0); try { DebugTool.assertTrue(holdr != null, "View holder has not been properly intialized."); String line1 = a.getString(R.styleable.StackedTextView_line1); setLine1(line1); String line2 = a.getString(R.styleable.StackedTextView_line2); setLine2(line2); line1Size = a.getDimension(R

Canvas.drawArc() artefacts

自古美人都是妖i 提交于 2019-12-20 10:44:59
问题 I draw an arc on canvas in a custom view as shown below. Paint and rectangle are defined outside of onDraw() and added in there for simplicity purpose. protected void onDraw(Canvas canvas) { super.onDraw(canvas); RectF rectangle = new RectF(60f, 60f, 480f, 480f); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setColor(0x40000000); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(120); canvas.drawArc(rectangle, 225f, 315f, false, paint); } When I run this code on Galaxy

center text and checkmark of CheckedTextView

风流意气都作罢 提交于 2019-12-20 10:44:49
问题 Layout i implemented like below picture : And code I used is : <CheckedTextView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/big_green_btn_normal" android:checkMark="@drawable/check_circle" android:gravity="center_vertical" android:text="@string/register_tempClickStaffingAgreement" /> This what i wanted,like the following picture : Share some idea to customize it but not with custom linear or any other layout..i want a single custom

Extended Toolbar with Custom View not Displaying with Full Width

旧城冷巷雨未停 提交于 2019-12-20 10:05:38
问题 I went through lots of answers here related to Toolbar but none of the answers could help me. What I'm trying to achieve is to have an extended toolbar whhich will display a logo, possibly a name of the Activity/App, it will have an action button/drawer toggle to the right that will display a navigation-like drawer to the right, an overflow menu with other options like settings and also a navigation Tab at the bottom that will allow the user to move between different fragments (different days

Android Circle Menu Like Catch Notes

拟墨画扇 提交于 2019-12-20 08:47:07
问题 I try to do circle menu like in this app. In "expanded" mode i draw this component like follows: <RelativeLayout android:id="@+id/bigCircle"> <!--color full borders--> <my.custom.component android:id="@+id/middleCircle"> <!--circle for buttons--> <RelativeLayout android:id="@+id/smallCircle"> <!--minus button--> </RelativeLayout> </my.custom.component> </RelativeLayout> In onDraw method of my.custom.component i divide circle on 8 parts by using android.graphics.Path with android.graphics

Custom alert dialog android

南楼画角 提交于 2019-12-19 11:57:48
问题 I am working with custom alert dialog in android. I have followed the link 1 and linke 2. In my code using these styles. <style name="DialogAnimation"> <item name="android:windowEnterAnimation">@anim/slide_up_dialog</item> <item name="android:windowExitAnimation">@anim/slide_out_down</item> <!-- Animation for dialog box --> <style name="DialogSlideAnim" parent="AppBaseTheme"> <item name="android:windowAnimationStyle">@style/DialogAnimation</item> </style> From these styles I am getting

Android custom progress bar with .gif file

微笑、不失礼 提交于 2019-12-19 11:45:35
问题 In my app i have a custom progress bar progress.xml <ProgressBar android:id="@+id/progressBar1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:progressDrawable="@drawable/loader" /> my gif file I want to create a progress bar with this image In other word i want to show this image whenever i download data from server and remove it after downloading the data or you can say , how to show this image as a progress bar 回答1:

Not getting RelativeLayout's getHeight() after setting Visibility Visible from Visiblity GONE

◇◆丶佛笑我妖孽 提交于 2019-12-19 10:45:09
问题 What i want is, when i click on Dashboard Button it will open like a SlidingDrawer and after it opened when clicked on it again it will close. i use this custom drawer because SlidingDrawer is Deprecated. now the problem is, its working properly except first time when i click on Button it'll open really fast without any animation, but closes properly and after that works fine. i found the problem is when i make RelativeLayout Visible and try to calculate its getHeight() it will give zero

Referencing custom view in XML doesn´t work both documented ways?

给你一囗甜甜゛ 提交于 2019-12-19 10:12:07
问题 <com.test.www.BrushPreview android:id="@+id/brushview" android:layout_width="100dip" android:layout_height="100dip" android:layout_gravity="center" /> and this not: <View class="com.test.www.BrushPreview" android:id="@+id/brushview" android:layout_width="100dip" android:layout_height="100dip" android:layout_gravity="center" /> Following the documentation http://developer.android.com/guide/topics/ui/custom-components.html#modifying it should work both ways! What am I doing wrong? edit:

Justifying text inside a TextView in android

人盡茶涼 提交于 2019-12-19 08:17:38
问题 So, as most of you know, there is no text justifying inside a TextView in Android. So, I built a custom TextView to get around the problem. However, for some reason, sometimes punctuation marks break the line for some reason in some devices. I tested on an LG G3 and emulator (Nexus 4 running latest version) and a comma "," for instance breaks the justification on the LG G3 but not on the emulator. If I add a Padding start and end (or left and right) of at least 2, the problem is solved. This