android-custom-view

Views within a Custom ViewGroup are not showing

守給你的承諾、 提交于 2019-12-13 12:06:12
问题 I have recently delved into creating custom ViewGroups and have encountered a problem I can't figure out. I have 2 ViewGroups - ViewManager and Article ViewManager simply lays out an Article below the previous Article (ie like a vertical LinearLayout) Article arranges several TextViews and an ImageView as you can see in the image. Creating a single Article and adding it to ViewManager works fine and everything shows up but when I add a second Article none of the content of the Article is

How to draw objects on TextureView Camera stream preview and record the stream with objects?

荒凉一梦 提交于 2019-12-13 08:50:39
问题 I need help with an application I am working on. The application has to have a custom Camera interface to record a video with audio and have to add some objects in realtime on the TextureView canvas. Old Camera API is deprecated, so I have to use Camera2 API to render the live preview on TextureView. My goal is to draw some objects on top of the TextureView Canvas, could be some text/jpg/gif while the camera stream renders in the background and being able to record the video with my overlay

Compound Drawable and setError problematic

可紊 提交于 2019-12-13 07:46:25
问题 Im using this library: https://github.com/lisawray/passwordview to toggle password on/off. Im also using setError when the password is false. It works from start. I enter a false password. Change to correct password in the EditText. Trying to toggle the drawable "eye", does not toggle anymore. The password text toggles correctly, but not the drawable set with setCompoundDrawablesWithIntrinsicBounds(...) Look after enter wrong password: The right drawble does not toggle anymore (the password

Android canvas drawRect colour always shows as grey?

南笙酒味 提交于 2019-12-13 07:08:29
问题 I'm creating a custom view on Android, but the rendered colour is always grey no matter how I try to change it. private void init() { Resources res = mContext.getResources(); float density = res.getDisplayMetrics().density; mBackgroundWidth = (int)(DEFAULT_WIDTH * density); // default to 20dp mPrimaryColor = gaugeColour; mPrimaryWidth = (int)(DEFAULT_WIDTH * density); // default to 20dp x_Corner=30*density; y_Corner=30*density; mRegularTextSize = (int)(mBackgroundWidth * 0.75); //Double the

Bounds in custom triangle button

半城伤御伤魂 提交于 2019-12-13 07:01:49
问题 I created a custom button as shown in the image. My problem is that the bounds still clickble. Is there any way to wrap the triangle. Image custom button My shape xml file : <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <rotate android:fromDegrees="45" android:toDegrees="45" android:pivotX="-10%" android:pivotY="87%" > <shape android:shape="rectangle" > <stroke android:color="@color/transparent" android:width="30dp"/>

Superpose many image View on an ImageView in a customView

佐手、 提交于 2019-12-13 05:17:46
问题 I would like to create a view in android that componsed of an ImageView and a TextView upon this ImageView . But the Custom views that we can create in Android contain attributes that can only be of certain types, as specified in this post : Defining custom attrs So I can't define a custom view with an ImageView attribute and a TextView attribute. I don't want to define it this way neither : <FrameLayout android:id="@+id/frame_layout" android:layout_width="wrap_content" android:layout_height=

How to use custom adapter while adding and editing listview items?

吃可爱长大的小学妹 提交于 2019-12-13 05:08:28
问题 I want to implement a to-do list application. I have three activities: one main activity, one adding activity and one editing activity. In my main activity there is a add button and a listview that shows the to-do items. When I click add button, adding activity is executed. In this activity,there is an edittext for the task, a datepicker and a spinner for priority level. When ok button is clicked, all these entred values are sent to main activity's listview as a line. And, when click an item

how to save check box values of custom list view using shared preferences

半世苍凉 提交于 2019-12-13 04:46:08
问题 i am trying to make launcher. i have have displayed the custom list with app_label,icon,package_name and check box. now i want to save selected app_name in shared preferences. i m not getting how to go through it. kindly help. here is my code: adapter = new ArrayAdapter<AppDetail>(MainActivity.this, android.R.layout.simple_list_item_multiple_choice, apps) { @Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; if (row == null) { convertView

Inflating custom View in ListView according to position

醉酒当歌 提交于 2019-12-13 04:29:10
问题 I have a ListView where I would like to inflate a custom View at a certain position. It's actually the 11th item (position 10). The getCount() method returns 11. Here is the top part of the getView() method: public View getView(final int position, View convertView, ViewGroup parent) { final ViewHolder holder; if (convertView == null) { if (position < 10) { convertView = mInflater.inflate(R.layout.standard, null); } else { convertView = mInflater.inflate(R.layout.custom, null); Log.i(TAG,

Custom scrollable layout with default values

懵懂的女人 提交于 2019-12-13 04:23:54
问题 I'm trying to make custom RelativeLayout inside ScrollView. Now I have to copy this part of code in every place where I want to use it: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="xxx" android:layout_height="yyy"> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top" android:layout_margin="@dimen/card_margin" android