w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How Android linear layout orientation affects layout gravity?
Just put gravity="right" into the horizontal linear layout, it should do the trick :) Works well in my case (just an exemple based on your layout): <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".MainActivity" > <!-- VIDEO BUTTON CONTAINER --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:background="#000000" android:gravity="right"> <!-- VIDEO

Categories : Android

Custom layout and gravity of TextView (horizontal gravity works but vertical fails)
We have found the solution. We need to call measure() on the children of the layout. @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); textView.measure(widthMeasureSpec, heightMeasureSpec); }

Categories : Android

Android layout gravity not Working
Move your textview, below the scrollview. You are using gravity in the wrong manner. I assume you want your copyright at the bottom fixed. Gravity is used to display contents of the view, in certain ways. or how to position the view itself, but it will not change the view hierarchy. </LinearLayout> </LinearLayout> </ScrollView> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="© 2013 Artcos Design. All Rights Reserved" android:textColor="@color/copyRightColor" android:textSize="10dp" /> </LinearLayout> you will also need to change the scroll view, so it does not take the screen height, but instead will best fill the area leavi

Categories : Android

what is the difference between layout and android:layout
include :: Sharing and reusing layouts is very easy with Android thanks to the tag, sometimes even too easy and you might end up with user interfaces that contain a large number of views, some of which are rarely used. For more infor refer this android developer doc. android:layout :: Android offers a very special widget called ViewStub, which brings you all the benefits of the without polluting your user interface with rarely used views. A ViewStub is a dumb and lightweight view. It has no dimension, it does not draw anything and does not participate in the layout in any way. This means a ViewStub is very cheap to inflate and very cheap to keep in a view hierarchy. A ViewStub can be best described as a lazy include. The layout referenced by a ViewStub is inflated and added to the

Categories : Android

While Sending Html Mails from my web application Recieved Mails contains Symbols like &ldquo,&rdquo, ‘
Check with another constructor for htmlView: ContentType mimeType = new System.Net.Mime.ContentType("text/html"); var htmlView = AlternateView.CreateAlternateViewFromString(bodyMessage, mimeType);

Categories : Asp Net Mvc

android layout vertical/horizontal weight
One solution is you can read the screen sizes with DisplayMetrics metrics = getResources().getDisplayMetrics(); int width = metrics.widthPixels; int height = metrics.heightPixels; and check different device screen sizes, if((metrics.heightPixels/metrics.density) >= 700) { Log.e(" 10 inch Tab", " 10 inch Tab"); } else if((metrics.heightPixels/metrics.density) >= 550) { Log.e(" 7 inch Tab", " 7 inch Tab"); } else if((metrics.heightPixels/metrics.density) >= 400) { Log.e(" 5 inch Tab / Mobile", " 5 inch Tab / Mobile"); } else { Log.e("All other mobile devi

Categories : Android

Android "Add a vertical line" on "RelativeLayout" / "Linear Layout"
You should complete the LinearLayout after you use View. I used the following code in my XML file, and it worked. It should work for you as well. <LinearLayout android:layout_width="fill_parent" android:layout_height="1dp" android:paddingLeft="5dip" android:paddingRight="5dip"> <View android:id="@+id/view" android:layout_toRightOf="@+id/text1" android:layout_width="1dip" android:layout_height="fill_parent" android:background="#FF0000FF"/> </LinearLayout>

Categories : Android

Android Layout Difference Between Different API Levels
The difference in rendering of a layout from one device to another should not be related to the version of Android running on the device. The difference, however, can be(and mostly is) due to different screen densities and dimensions. This problem is (to some extent) nullified by using dp(density pixel) instead of px(pixel) while dimensioning views. You can further reduce the oddities by using different dimens.xml for different screen densities. This way, you will have a dimens.xml inside values-mdpi, another one inside values-hdpi, and yet another in values-xhdpi. I prefer another approach. I like to handle positioning of items using the screen dimensions. I get the screen width and height at runtime, and programmatically add margins and padding to layout items. // Get screen dimens

Categories : Android

Android Layout - Positioning Views based on Horizontal Center
I don't think there will be enough space to add all these guys in one raw, specially for phones, not tablet. but if you want to do that, it's better to surround your relative layout by horizontal scroll view as in the following layout. also don't use padding or margins just to push your view to the desired location, it's really considered a bad layout design. <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:con

Categories : Android

EditText hidden by keyboard when android:gravity="center" - Android
I recently dealt with this issue on a Nexus 7 phone. The behaviour didn't otherwise occur on any of our other test phones. The trick seems to be to change the focus BEFORE you close the softkeyboard. The keyboard is closed at 3 points - clicking the Done button, clicking outside of the edittext box, and clicking the back button. First, create a hidden element to eat your focus <MyEditText android:id="@+id/editHidden" android:layout_width="0dp" android:layout_height="0dp" android:layout_below="@id/imageLogin" /> I stored this but it's a bit ugly... @Override protected void onResume() { super.onResume(); Utils.focusable = findViewById(R.id.editHidden); Now change the focus to your hidden element wh

Categories : Android

android:gravity="top" doesn't align child view to top, but "center" aligns to center?
gravity attribute applies to widgets within the LinearLayout, while layout_gravity tells the parent of LinearLayout where to place the child (LinearLayout). Also, in a vertical LinearLayout the gravity="top" attribute won't work. In the layout you have now, both text views will be stacked one on top of the other, wrapped with a linear layout with no space in-between - so the "top" or "center" values won't do anything because there is no extra space to move the text views up or down. If you want to understand this better, try giving your linear layout and both text views backgrounds of different colors, like this: android:background="@color/mycolor" Then you will see the bounds of each widget.

Categories : Android

D3 Tree Layout - Custom Vertical Layout when children exceed more than a certain number
You could dynamically count the children and adjust the width/height of the DOM element accordingly. I would recommend counting the maximum number of children in any level, which can be calculated using the depth property provided by d3.tree.nodes(), or just by recursively going down the tree. Modifying some code which was in a previous SO answer, you could have something like this: var levelWidth = [1]; var childCount = function (level, n) { if (n.children && n.children.length > 0) { if (levelWidth.length <= level + 1) levelWidth.push(0); levelWidth[level + 1] += n.children.length; n.children.forEach(function (d) { childCount(level + 1, d); }); } }; childCount(0, root

Categories : Javascript

Android layout , does it support orientation layout xml files? Does -land work at all?
for the activity in the manifest remove the orientation flag,...then your activity will destroy and recreate itself on rotation giving you the correctly included layout. android:configChanges="keyboardHidden" If you leave it in, it is up to YOU to handle the orientation change with code.

Categories : Android

Android Graphical Layout editor black main window with custom layout
This is because you have edited the theme of that particular xml file. you just need to click on your desire xml and change its theme from the theme option right in the center of the screen right side from the nexus S selection of yours... or u can goto res>values>strings and change the string responsible for theme selection.

Categories : Android

How to change the position of a linear layout within its parent frame layout in Android
You can try swap LinearLayout with RelativeLayout. And then when you want to make some view to be under/above another you can use this: RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.BELOW, R.id.YOUR_VIEW_ID); YOUR_VIEW.setLayoutParams(lp);

Categories : Java

how to change properties of controls (for eg: textview) of layout included in another layout android
Attach an id attribute to each included layout. Then find this view by findViewById method passing the attached id and use findViewById method of the found view to change the attribute of particular TextView.

Categories : Android

Android - Position Relative layout within main layout Dynamicaly
Why do not you want to use the fragments for these purposes? You can use three frames with weight 1, for example, in LinearLayout with horizontal orientation in your main layout file. Then create three layouts for each frame. For dynamic work with previous you can use FragmentManager and FragmentTransaction. Read about them please.

Categories : Java

How to add a layout to current Main Activity layout using Thread in Android
You can't initialize your UI from a worker thread. You have to do this in the main thread. A thread will be only use to make some complex calcul. Everything is here :http://developer.android.com/guide/components/processes-and-threads.html You can add a initUI function @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initUI(); } private void initUI() { FrameLayout layout = new FrameLayout(this); layout.setBackgroundColor(Color.BLACK); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(300, 75, Gravity.CENTER); TextView txt = new TextView(this); txt.setText("ASD"); layout.addView(txt); getWindow().addContentView(layout, params); } @Override publ

Categories : Android

How to place table layout below Linear layout programmatically in android
ScrollViews in android should contain only a single child. So might I suggest you add a LinearLayout inside the ScrollView and then add the other components in this LinearLayout

Categories : Android

layout-xxhdpi/layout-xxlarge not supported on Android Studio
As you can see here, section "Declaring Tablet Layouts for Android 3.2": For the first generation of tablets running Android 3.0, the proper way to declare tablet layouts was to put them in a directory with the xlarge configuration qualifier (for example, res/layout-xlarge/). In order to accommodate other types of tablets and screen sizes—in particular, 7" tablets—Android 3.2 introduces a new way to specify resources for more discrete screen sizes. The new technique is based on the amount of space your layout needs (such as 600dp of width), rather than trying to make your layout fit the generalized size groups (such as large or xlarge). The best you can get is: res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation The ones you

Categories : Android

Bootstrap Layout breaks on iPhone vertical layout
So far as I can see it looks good, or I don't understand what should be wrong, except of the big buttons in the mobile view. The only thing I found was the orientation change who doesn't works well. But this is easy to fix with adapting your meta viewport like: <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

Categories : CSS

Linear layout inside Lineary layout in android
Your parent layout is showing the child layout, but it is out of view. Change the Parent's layout orientation to Vertical and it will be visible. Make these changes.. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:baselineAligned="_baseline" android:orientation="vertical" > To get edittext in the same line, Create a child layout for textview and edittext and make its orientation as horizontal.. it will be in the same line <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:baselineAligned="_baseline" android:orientation="vertical" > &

Categories : Android

In Android, how to I edit views in a layout, when my setContentView is not in that layout?
This does not work in all situations, but you could try a LayoutInflator. LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.your_layout, null); Then to find views in that layout, just do... layout.findViewById(R.id.your_view);

Categories : Android

Magento overriding a layout file causes the overriden layout to duplicate
Well I found the answer: My REAL issue is that I did not know enough about references and blocks. My TECHNICAL issue is that I was referencing one block and then creating a new block with a different name. The "Left" block also contained a version of the navigation bar. This was causing the duplicate menus. My final code looks like this: <affiliateplus_default> <block type="affiliateplus/account_navigation" before="-" name="account_navigator" template="affiliateplus/navigation.phtml"> <action method="setNavigationTitle"> <title helper="affiliateplus/account/getNavigationLabel" /> </action> <action method="addLink" translate="label" module="affiliateplus"> <name>b

Categories : Xml

How to position a inflated layout at the center of parent layout
Use android:layout_gravity="center". See LayoutParams: Place the object in the center of its container in both the vertical and horizontal axis, not changing its size. PS: Since you wrap your ImageView with a container in your child view, I believe you should add gravity property in the wrapper. That way the "container" is your main, not the child view's wrapper.

Categories : Android

Layout Weight in Linear Layout Android?
I can't tell if this is your only problem yet but when you use layout_weight inside of a vertical LinearLayout then your layout_height should be 0dp. Likewise if it is inside of a horizontal LinearLayout then the layout_width should be 0dp. Also, all of the layouts should have a weight if you are using it on one of thenm. android:layout_below= in your third LinearLayout, I believe, is not a property of LinearLayout. That is a property of RelativeLayout. My suggestion for this type of setup is to use RelativeLayout as the root layout. Then, for your header LinearLayout you can use android:layout_alignParentTop="true" and for your footer use android:layout_alignParentBottom="true" then stick your ListView in the middle with android:layout_below="@id/idOfHeaderLL" <RelativeLayout ..

Categories : Android

Relative Layout v/s Grid Layout for Android
My opinion is use gridlayout.Because grid layout is very simple to make text and image view similar to windows 8 start screen.For relativelayout you have to put some effort more than grid.And also gridlayout make widget as u want live.More clarification you can refer this page. https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/widget/GridLayout.java

Categories : Android

Why layout is different in graphical layout and AVD , where both are working on android 2.2 API 8
Unfortunatley I cannot comment on your post.. but could you please upload your .xml file? Maybe you built your layout on a "screen" with a resolution different from the one of AVD VM or you are using a relative layout. Just post the .xml Try changing your xml layout like this : <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="15dp" android:paddingRight="15dp" tools:context=".MainActivity" android:orientation="vertical" android:background="#54616d" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Dial Nu

Categories : Android

What is difference beetween layout:'hbox' and layout:'column'
Column existed in an earlier version of the framework before VBox and HBox. It's mostly been kept for compatibility reasons. HBox offers more functionality (pack and align), amongst other things.

Categories : Extjs

android:gravity - bottom vs. end. What's the difference?
"end" means "right" but with proper RTL support. So if your using an RTL language "end" means "left" ;) See this Google+ post for more info

Categories : Android

android masking a layout with other layout
Try set this to this layout: OnTouchListener listener = new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true;//consume the touch event } }; yourLayout.setOnTouchListener(listener);

Categories : Android

Layout having two layout in it Horizontally Android
both widths for the sub layouts are match_parent so only one will show, match_parent is for the main layout and all sublayouts and elements should have fill_parent instead, Also because you are using weight you can set the width to 0dp and the weight will take care of the scaling <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:baselineAligned="false" android:gravity="center"> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" android:gravity="center"> <ImageView an

Categories : Android

difference between layout and layout-400dp-land
You can't The original Note runs GingerBread (2.3) and the sw- identifiers only work from 3.2 upwards. http://developer.android.com/guide/practices/screens_support.html#support The configuration qualifiers you can use to provide size-specific resources are small, normal, large, and xlarge. For example, layouts for an extra large screen should go in layout-xlarge/. Beginning with Android 3.2 (API level 13), the above size groups are deprecated and you should instead use the swdp configuration qualifier Devices < 3.2 will not use the -sw layouts. To support all API levels you will need to provide layouts using both types of qualifiers. Check out this post: http://android-developers.blogspot.co.uk/2011/07/new-tools-for-managing-screen-sizes.html Previous versions of the p

Categories : Android

AbsListView LayoutParams Set Layout Gravity
I think you need to get rid of the ListView. Replace the ListView with a FrameLayout and use the layoutinflater to add the "listview" child into the FrameLayout. When using the layoutinflater set the FrameLayout.LayoutParams with the gravity property assigned to the root of the child (LinearLayout). Good luck.

Categories : Android

Why i can't lock DrawerLayout with layout gravity
Based on the documentation, the only available gravities that can be used are Gravity.LEFT, Gravity.RIGHT or GravityCompat.START, GravityCompat.END. (Emphasis mine): Drawer positioning and layout is controlled using the android:layout_gravity attribute on child views corresponding to which side of the view you want the drawer to emerge from: left or right. (Or start/end on platform versions that support layout direction.) Looking at the source code public void setDrawerLockMode(int lockMode, int edgeGravity) { final int absGrav = GravityCompat.getAbsoluteGravity(edgeGravity, ViewCompat.getLayoutDirection(this)); if (absGrav == Gravity.LEFT) { mLockModeLeft = lockMode; } else if (absGrav == Gravity.RIGHT) { m

Categories : Android

How can ı make Layout for Small than 3" screen and Layout for 4.8" screen (android)
Android has a lot of really nice tools to help developers deal with multiple screen sizes and densities. You can read more about how it all works at this Android Developers Page.

Categories : Android

How to show a button half on one layout and half on another layout in android?
You can put the Button declaration outside of your RelativeLayout relative_layout_bottom and then place it where you like. For example: Edit: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <RelativeLayout android:id="@+id/relative_layout_top" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/obaz" > </RelativeLayout> <Button android:id="@+id/bt_atoz" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_ce

Categories : Android

Add Relative Layout below current Relative Layout programmatically in Android
You could use a global variable to store currentId assigned to layouts, and update it every time u add a layout. int currentId = 10; button click function public void onClick(View v) { if(v==newLayoutButton){ layout.addView(createNewLayout(newLayoutContainer,currentId), 0); currentId++; } } createNewLayout function will have one more attribute as currentId. public RelativeLayout createNewLayout(RelativeLayout newlayout, int currentId){ newLayoutContainer = new RelativeLayout(this); final RelativeLayout.LayoutParams newLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, dpContainerHeight); newLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); newLayoutParams.addRule(RelativeLayout.BELOW, currentId); newLayoutParams.setMargins

Categories : Android

screen support multiple devices using layout-large,layout-normal and layout-xlarge folders
Here there is the official description of how support all the screen size. And as described the layout folders are: res/layout/my_layout.xml // layout for normal screen size ("default") res/layout-small/my_layout.xml // layout for small screen size res/layout-large/my_layout.xml // layout for large screen size res/layout-xlarge/my_layout.xml So layout and layout-normal folder are the same, but in the new Android API there isn't no more the layout-normal folder, but only layout folder. Also you have to know if there isn't the specific layout of the screen size in witch the app is running, by default the app takes the "default" layout. EDIT You can have different screen resolutions in the same folder, as you can learn from this images: If you want a more spec

Categories : Android

How to adjust images to all android screen devices using cocos2d android library without using xml layout for Game designing
CGSize winSize = CCDirector.sharedDirector().displaySize(); CCSprite background=CCSprite.sprite("background.png"); background.setScaleX(winSize .width/background.getTexture().getWidth()); background.setScaleY(winSize.height/background.getTexture().getHeight()); background.setPosition(CGPoint.make(winSize.width/2, winSize.height/2)); addChild(background); Set to exact , what is the screen size

Categories : Android



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.