custom-view

Error in creation of custom view

爷,独闯天下 提交于 2019-12-06 08:38:35
问题 i have customview, i want to add that in the xml file i tried like this but i am getting this error Custom view TouchImageView is not using the 2- or 3-argument View constructors; XML attributes will not work this is the xml i am using.. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <view class="com.zoom.TouchImageView" android:id="@+id/webView1" android:layout

ActionBarSherlock landscape mode

徘徊边缘 提交于 2019-12-06 08:02:54
I've read a ton of stuff on this actionbar however, i am having problems with it in landscape mode i want to create a custom view above the tabs this is my code import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.SherlockActivity; public class MainActivity extends SherlockActivity { private ActionBar bar; @Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_Sherlock); super.onCreate

Android AlertDialog with rounded corners: rectangle seen below corners

戏子无情 提交于 2019-12-06 05:59:18
问题 I want a Dialog with rounded corners, but when the Dialog is seen there's a rectangle below it that's seen below the corners, like this: I build the dialog using a custom DialogFragment : public class MyDialogFragment extends DialogFragment{ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); builder.setView(inflater.inflate(R.layout.playdialog,

how to use custom views in layout xml

落爺英雄遲暮 提交于 2019-12-06 05:00:31
I've created a custom layout to show gif animated image. Here is the code: public class GIFView extends View{ private Movie movie; private InputStream is; private long moviestart; private long duration; public GIFView(Context context) { super(context); is=getResources().openRawResource(R.drawable.anim_cerca); movie=Movie.decodeStream(is); duration = movie.duration(); } public GIFView(Context context,AttributeSet set){ super(context,set); is=getResources().openRawResource(R.drawable.anim_cerca); movie=Movie.decodeStream(is); duration = movie.duration(); } public GIFView(Context context

Xamarin Monodroid: WP7 => Android and Custom Control?

一个人想着一个人 提交于 2019-12-06 00:59:06
i am in the process of porting some of my Windows Phone Applications to Android using Xamarin Monodroid. I am pretty new with the Xamarin stuff, just bought a license actually. So far so good as far as recreating the XAML UI in AXML but i am facing a problem with Custom Controls. Here is what i mean by custom controls: In .NET, i created a bunch of controls by creating class that inherit from the 'UserControl' class, i created the logic and set the Content. Then i just create new instance with 'new my_control()', etc... Some of my controls are not created this way but instead i created the

Custom View in UIAlertController

爷,独闯天下 提交于 2019-12-05 22:48:00
I am trying to put a custom view inside a UIAlertController . I'm running into some odd issues with the sizing of the custom view. I want the custom view to span the width of the UIAlertController , whatever that might be. I'm using CGRectGetWidth(alertController.view.bounds) to get the width of the alert controller. However, this seems instead to be returning the width of the entire view. using view.frame does not make a difference. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"My Title" message:nil preferredStyle:UIAlertControllerStyleAlert]; UIView *view

Change custom button size for layouts and containers

可紊 提交于 2019-12-05 16:56:08
I have a custom class (touchbutton) extending the TextView class. I am having trouble resizing the button manually. I can get the button to work for only one type of layout or container, but not both. For the most part, Touchbutton is in gridviews so my method to change the size is as so: private void setLayout(buttonsize_t size) { log("Setting Layout: "+buttonsize_t.getPxl(size)); final float scale = getContext().getResources().getDisplayMetrics().density; int dim = (int) (buttonsize_t.getPxl(size) * scale + 0.5f); AbsListView.LayoutParams params = (AbsListView.LayoutParams) getLayoutParams()

how to access custom attribute with multiple formats?

狂风中的少年 提交于 2019-12-05 07:56:40
I read in another answer that in android you can declare attributes for your custom view that have multiple formats like this: <attr name="textColor" format="reference|color"/> how can I access these attributes in my class? Should I just assume it to be a reference, use getResources().getColorStateList() and then assume it to be a raw RGB/ARGB color if Resources.getColorStateList() throws Resources.NotFoundException or is there a better way of differentiating between the formats/types? It should be something like this: Variant 1 public MyCustomView(Context context, AttributeSet attrs, int

How can i pass Touch Listeners to Custom View for Drag and Drop?

我的未来我决定 提交于 2019-12-05 06:37:54
I've a question concerning handling touch events for CustomView .I'm adding custom view's dynamically to layout (i.e FrameLayout). Those custom views having touchListeners for pulling points at corners (It shows in the below image). Along with that i have to drag and drop the total view on the screen, if user touches other than those corner points (color area in the image) have to drag and drop of the view otherwise not, and also if user touches outside of that view i don't want trigger any touch listeners. I am able to pull those points by using this code @Override public boolean onTouchEvent

Cocoa draw noise

三世轮回 提交于 2019-12-05 05:41:00
问题 Is it possible to draw some noise on top of a rect I filled using NSRectFill? I need to make my app that draws a custom title bar look wonderful on 10.7 before release, and to make it look a little more like iTunes. I would love if this is possible using no images, but if I have to include a PNG or something as a mask, I'd be fine with that. Thanks! 回答1: You can either use drawing logic (drawing a lot of small rects, lines or other polygons), or use NSImage's drawing methods, like for