android-custom-view

material checkbox style after customize

落爺英雄遲暮 提交于 2020-05-23 21:05:25
问题 My customized checkbox ( MyCheckbox ) has extended from androidx.appcompat.widget.AppCompatCheckBox , but the default styles don't apply to it. <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> ... <item name="android:checkboxStyle">@style/CheckboxTheme</item> <item name="checkboxStyle">@style/CheckboxTheme</item> </style> <style name="CheckboxTheme" parent="@style/Widget.AppCompat.CompoundButton.CheckBox"> <!-- for example try to change background --> <item name=

material checkbox style after customize

人走茶凉 提交于 2020-05-23 21:05:05
问题 My customized checkbox ( MyCheckbox ) has extended from androidx.appcompat.widget.AppCompatCheckBox , but the default styles don't apply to it. <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> ... <item name="android:checkboxStyle">@style/CheckboxTheme</item> <item name="checkboxStyle">@style/CheckboxTheme</item> </style> <style name="CheckboxTheme" parent="@style/Widget.AppCompat.CompoundButton.CheckBox"> <!-- for example try to change background --> <item name=

Create a custom WebView

萝らか妹 提交于 2020-05-11 06:40:52
问题 I have a lot of WebView in different parts of the program, but these WebViews does not differ each other that is why I want to create a custom WebView with necessary settings. At the current moment, WebView doesn't show, but no errors. Am I doing something wrong? public class MyWebView extends WebView { MyWebView mMyWebView; public MyWebView(Context context) { super(context); } public MyWebView(Context context, AttributeSet attrs) { super(context, attrs); } public MyWebView initView(Context

How to get android default attributes in a custom view

血红的双手。 提交于 2020-03-21 17:57:28
问题 I have created a simple custom view that contains a RelativeLayout and an EditText : <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/edt_content" android:layout_width="match_parent" android:layout_height="wrap_content"/> </RelativeLayout> Also I have added some custom attributes in res/values/attrs.xml and I retrieve these attributes in my custom view constructor and

How to rotate text drawn in a straight line (without radius) when using drawTextOnPath?

一个人想着一个人 提交于 2020-03-03 10:10:32
问题 I want to rotate the numbers in canvas, This is what I have tried: override fun onDraw(canvas: Canvas) { var i = 0 while (i < rulerHeightInInch) { val markingPositionYaxis = screenHeightInPx - (ydpinch * i + topThreshold) paint.textSize = getPixelValueForDp(18.0f) val path = Path() path.reset() path.moveTo( (getPixelValueForDp(30f) + paint.textSize), markingPositionYaxis +17 ) path.lineTo( (getPixelValueForDp(30f) + paint.textSize), markingPositionYaxis - (paint.textSize) ) canvas

trying to crop bitmap using mask throws IllegalArgumentException:

守給你的承諾、 提交于 2020-02-23 07:13:08
问题 I am using following code public void cropSelection(){ Bitmap bitmap = annotationBitmap.copy(annotationBitmap.getConfig(), true); Canvas canvas = new Canvas(bitmap); Paint p = new Paint(); // p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.XOR)); canvas.drawBitmap(imageBitmap, 0, 0, p); // this line throws error imageBitmap = bitmap; } More surprisingly when I am using the same line canvas.drawBitmap(imageBitmap, 0, 0, p) inside onDraw() it does not throw any error. It works well.

Custom circular view [closed]

前提是你 提交于 2020-02-17 14:04:11
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 days ago . I want to create a view shown in image below 回答1: I think it's very late response, but It can helpful to others as well. I find a library, reworked on listview and implemented circular list. Library is here and some snippet of code public void changeGroupFlag(Object obj) throws

layer list losses its shape in second activity after applying animation

血红的双手。 提交于 2020-01-25 07:24:12
问题 hi i am making an app where i'm basically i have two activities. In first activity i have one textview and imageview and in imageview i have set a layerlist as background and same goes for the second activity. Now my problem is that when i apply shared element transition animation in first activity then both the textview and imageview are animated but layerlist in second activity losses its shape you can see the below images. and Now screens with animation Now from the above images you easily

Android - move an ImageView on screen (Like dragging)

懵懂的女人 提交于 2020-01-22 10:49:06
问题 I'm trying to create an app that can move an ImageView on your device like dragging and when I put like 75% of the ImageView out of the screen show a Toast for example. I've been reading about MotionEvent and onTouchListener and I've followed this question, but it doesn't convince me. Edit My current code is : public class MainActivity extends AppCompatActivity implements View.OnTouchListener { int windowwidth; int windowheight; private ImageView mImageView; private ViewGroup mRrootLayout;

GridView is not Scrolling smoothly

做~自己de王妃 提交于 2020-01-17 11:16:46
问题 I have 100 plus images present in drawable folder I am creating gallery in GridView, But facing scrolling issues. gridView is not scrolling smoothly although I have used ViewHolder... here is my code... public class MainActivity extends Activity { int[100] Names_images = {R.drawable.img1,R.drawable.img3,R.drawable.img4,R.drawable.img5,R.drawable.img6,...};//100 images String[100] names = {"name1","name2","name3","name4","name5","name6",...};// 100 names GridView gridview;