Android layout Gravity is not set on Relative Layout

I am tackling relativeLayout problem in my application. I take one image and button. I want to make button is bottom of the image but is not set. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageButton android:src="@drawable/layout_logo" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id

Android layout Which android layout to use for distributing variable width buttons to fill a screen?

I am getting started with Android, trying to write a "concentration" game for kids where a screen full of text is separated into buttons, filling the screen (one word per button) The buttons should wrap to the contained text, so longer words will have longer button widths. Once a row fills up, the next button should flow to the next row, and so on, until the whole screen is filled with evenly spaced variable width buttons. The number of rows and number of buttons per row varies based on scree

Android layout SlidingDrawer broke ViewPager workng

I have a simple layout with some page title, ViewPager and SlidingDrawer. There is my layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <com.viewpagerindicator.TitlePageIndicator android:id="@+id/indicator" android:padding="5dip" androi

Android layout SlidingDrawer and imageview in android

I have a imageView in a tab. So basically tab just opens an imageView. I want to have a SlidingDrawer, but seems like imageView and SlidingDrawer doesn't show up together. Does anybody know how to make them work together? My xml for the tab: <?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:grav

Android layout Linear layout clickable error

In my Andoid app. I have a clickable linear layout that I've generated programmaticly, and I want it to turn green when it is pressed to indicate that it is clickable, like a button would. How would I go about doing this? This is my code i implemented in my Header layout. <LinearLayout android:id="@+id/back_lay" android:layout_width="46dp" android:layout_height="46dp" android:layout_marginLeft="10dp" android:background="@android:color/transparent" android:gravity=

Android layout How dynamically update zoom/slide of one graph in other graph (Here 2 graphs displaying in same screen using in listview)

I am using ListView to display 2 graphs in same screen, below is code. class MultiGraphAdapter extends ArrayAdapter<View> { public MultiGraphAdapter(Context context, int resId, List<View> views) { super(context, resId, views); } @Override public int getCount() { return 2; } @Override public int getViewTypeCount() { return 2; } @Override public int getItemViewType(int position) { return position % 2; }

Android layout dynamically updating the layout Android

I am designing a layout in which i have 3 buttons at the center of the screen and a grid view at bottom f the screen. in the grid view i am adding images. but when i am adding images the buttons are fixed at their places and after many images gridview start covering the buttons starting from bottom. is there any way i can dynamically adjust the screen when the number of image increase. my activity.xml file <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tool

Android layout Selector not working in Textview for changing textColor for disabled state

I want textColor as black even if textView is disabled. For it I use a selector but its not working, its giving me default grey textcolor in disabled state. Selector file is as follows: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:state_focused="true" android:color="@color/black" /> <item android:state_enabled="false" android:state_focused="false" android:colo

Android layout blur image in android studio

I"m trying to make background image in black activity.. this is the image i try to upload.. i add a photo in res -> new -> image asset and i locate the image and select it.. after i add "imageview" to my activity and choose the resourse that i have created... this is how it go:

Android layout Add toolbar in android app

I want to add toolbar in my android app but I am getting this error in my StudentDashboardActivity.java at run time after pushing my app on git. I could not find what's the problem behind of it. FATAL EXCEPTION: main Process: com.technerdshub.vusocial, PID: 31319 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.technerdshub.vusocial/com.technerdshub.vusocial.Activities.StudentDashboardActivity}: java.lang.IllegalStateException: This Activity al

Android layout How to implement tabview in one of the fragment of bottombar?

I want this type of design :: Here Is My design My mainactivity.xml only contain a frameLayout which is Replaced by Selected Fragment from bottombar menu item. It's code is here: b = BottomBar.attach(this,savedInstanceState); b.setItemsFromMenu(R.xml.menu_main, new OnMenuTabClickListener() { @Override public void onMenuTabSelected(@IdRes int menuItemId) { if(menuItemId == R.id.BottomBarItemOne){ PeopleFragment p = new PeopleFragment();

Android layout The layout could not be loaded

I am new to Xamarin, after installing i'm trying to make a Hello Android app, I made it! However, when I try to open Main.axml the app layout, I get this error: System.ComponentModel.Composition.ImportCardinalityMismatchException: Aucune exportation correspondant à la contrainte ContractName VisualStudioWorkspace RequiredTypeIdentity Microsoft.CodeAnalysis.Workspace n'a été trouvée. à System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposi

Android layout Xamarin.Forms content not showing after using Acticity.SetContentView

After using Android layout this.SetContentView(Resource.Layout.Main), and LoadApplication(new App()), I could not see Xamarin.Forms MainPage.xaml. I tried to remove the Linear Layout, but it just removing items inside them, not the form itself. It seems like SetContentView blocking the Xamarin.Forms. So, Here is MainActivity.cs: using Android.App; using Android.Content; using Android.Content.PM; using Android.OS; using Android.Text.Method; using Android.Widget; using Auth0.OidcClient; using Id

Android layout What is difference between Android widget position left and start (or right and end) for create Constraint?

For example, if i want to position button B to the right of button A. Relative Positioning Constraints: I can to use: 1)<Button android:id="@+id/buttonB" ... app:layout_constraintLeft_toRightOf="@+id/buttonA" /> Or 2)<Button android:id="@+id/buttonB" ... app:layout_constraintStart_toRightOf="@+id/buttonA" /> What is difference between example 1 and 2? References: https://developer.android.com/reference/android/support/constraint/Constrain

Android layout Access single xml file using different activity in android

Now I develop a multiplayer (In a single device) game and countdown Timer seperatly. The game have 1 Activity and 1 xml,and countdown timer also have 1 activity and 1 xml. I want to add the timer inside the game and in new project I design a new xml file that containing game board and timer.How to access this single xml file using Game activity and countdown timer activity?

Android layout I can share the text of a layout?

I can share the text of a layout in social networks or whatsapp, email? Thank you. I have this code. I have this code. Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send."); sendIntent.setType("text/plain"); startActivity(sendIntent); I could not program the button to share, thanks

Android layout Invalid layout resources

Sometimes when my Xamarin.Android app gets killed and the application needs to recreate its main activity some layouts are not available and the screen displays no views. By pressing the device back button and then reopening the application, its main activity gets correctly instantiated and displayed. This is the code responsible for loading the used layouts: // Returns null whenever trying to recreate views right after the application got killed by Android (Due to some multi-tasking reasons)

Android layout Insert ImageView inside ListItem

I have the following code which show me a listitem with name, score, sex, age and country: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="10dip" > <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <TextView android:id="@+id/te

Android layout Layout snaps to visible (first time only) instead of slide animation

I'm creating a 2 row info bar in the bottom of the screen. At first only the top row will be visible. Press an 'expand' button, the 2nd row will slide up from below. Now both the rows are visible. Pressing same button again, the bottom row slides down, and only the 1st row is visible. This scenario is very common, and after checking different implementations, I've come to this simple one which works almost perfectly: 2 layouts in 1 > make bottom GONE > onClick - make bottom VISIBLE and appl

Android layout Linear Vertical Layout - Android

In Android App development,I want to create a Linear Vertical layout as my main Screen . and some 'n' textviews in it , and whenever i click on any of the textviews , it must direct to any of the layouts that I have created . How to do that ?

Android layout I try to get this DrawerLayout working but cannot find what is wrong

Everything works I can pull out drawer and toolbar is ok but the "@+id/frame" where I add my Fragment is not visible. XML <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context="com.port.android.ui.Activity

Android layout Is the below xml file right?

Is the below xml file right? I am trying to display information that I have fetched from sqlite in recycler view. Is the below xml file right? I am trying to display information that I have fetched from sqlite in recycler view. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" androi

Android layout Android round corner and bitmap repeated background

I'm trying to have the following background for a Layout in my Android Application : So I need 2 rounder corner, and a repeated checkered background. and of course the height and weight are not fixed :) I've tried to build a shape with this attributs, but I can't use a checkered background ... And I can't use a 9 path because of the checkered background ...

Android layout how to preserve listview selected/ clicked item color while scrolling?

this is really a strange problem i came across several google searches which returned in vain . Well i have a list view in which the selected item color should be changed while user click on the item. This post helped me to change the list view selected item color. Now i am able to change the color while the item is clicked . But if i scroll the list view the color jumps out of selection. https://stackoverflow.com/a/12080202/1657093 If a item is selected say for instance the listview item

Android layout I can't define layout for Samsung Galaxy Note 2

I have 2 mobile phones: HTC Explorer and Samsung Galaxy Note 2 HTC Explorer 320 x 480 pixels 3,2" 180 dpi 285dp x 426dp Samsung Galaxy Note 2 730 x 1280 pixels 5,5" 267 dpi 432dp x 767dp I have a resource folder with name "layout", and when I install my app in HTC, it takes the layout from this folder "layout" I want that when I install the app in Samsung Galaxy Note 2, it takes the resource from another folder because the screen is bigger and the view is different. I hav

Android layout ViewPager scroll X position always returns 0

I have two Viewpagers one above the other in my layout file. Bottom viewpager has 3 imageviews and the top view pager is empty with transparent background. I want to pass the scroll event from top pager to bottom pager to see the paging. Below is the code, and is not working properly. getScrollX always returns 0, please let me know the solution. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.acti

Android layout Cordova Android project creation

I have followed the steps: npm install -g cordova cordova create workshop com.yourname.workshop Workshop cd workshop cordova platforms add android I am getting this error after add android: C:\Users\SCube\.cordova\lib\android\cordova\3.4.0\bin\node_modules\ throw e; ^ Error: ERROR : executing command 'ant', make sure you have ant inst ed to your path. at C:\Users\SCube\.cordova\lib\android\cordova\3.4.0\bin\lib\ch 7:27

Android layout Dynamic conversion of Text size in custom view getting wrong in android

I am trying to calculate text size of the EditText dynamically in my custom View. Following is my code snapshot. in my values/dimens.xml file, I have defined a size <dimen name="default_view_height">180dp</dimen> I am using this dimension through custom attributes, so I retrieve this, in my CustomView, I have retrieved this value using the following default_view_height = attrsArrays.getDimensionPixelSize(R.styleable.CustomView_defaultViewSize,DEFAULT_VIEW_SIZE); and in my cus

Android layout Override of Resources in library project

im having a library project which has a Default Fragment implementation. I also added some template methods where the Main Project can hook in and return another Layout Resource ID to be inflated. The Problem i get is that the Runtime sees duplicated IDs. I wonder how this can be avoided ? @IdRes @Override public int getDrawerLayoutResID() { return R.id.drawerLayout; } @LayoutRes @Override public int getLayoutResID() { return R.layout.master_detail; } Lib Project: BaseFragment lay

Android layout change text position to bottom left on screen rotate android

I have to display a text (id- text_view in the code below)at the bottom left of the screen. Find below the code snippet for the text. <?xml version="1.0" encoding="utf-8"?><merge xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" > <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_vertical

Android layout In visual studio 2017, why won't xamarin app controls (button, editText) show up?

I just built my first Xamarin app using Visual Studio 2017. I built the main app from the template and it ran fine. Now, I added two controls to the layout (a button and an EditText) which render fine in the design view but do not show up when the app runs. Here's the layout xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_h

Android layout What is the exact meaning of match_parent?

I just want to check my understanding is right. In android studio, layout attributes there are layout_width, layout_height. I know both of them as Widget / Layout 's width and height. and we can assign match_parent there. According to my understanding, match_parent always means the widget's height/width is same as the Activity's. Is my understanding correct??

Android layout I cannot evenly space buttons

I am using constraint layout in android studio, I want to evenly space buttons on main activity, it works fine on mobile view, but when I try to switch to tablet view it gets messed up, is there any way to evenly space buttons on both views?here is the problem in image

Android layout Android: define which attributes a custom view uses for content assist

I've got some custom views and custom defined attributes. I'd like to define which attributes my views use so that eclipse can use that for content-assist. For example, I've got a custom xml attribute declared like so in my res/values folder: <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="TagAttrs"> <attr name="spColor" format="color" /> </declare-styleable> </resources> And my layout file uses a custom view wi

Android layout About android layout with two imageView

I have movies Application and I am working in the details of the movie layout now I have two posters for each movie (orginal poster and backdrop poster) I am working to make some thing like this: I am trying to do that but I have problem which is: the backdrop poster came to the front of orginal poster and hide it (backdrop poster hide the orginal poster) how I can send the original poster to the front of backdrop poster this is my code: <?xml version="1.0" encoding="utf-8"?> <

Android layout layout_alignBottom not working when two TextViews using different textSize using RelativeLayout

If I set the "·more·" TextView's textSize to "15dp",then these three elements(the "·more·" TextView , "6.4 MB" TextView and "@+id/edit" ImageView) are bottom algined. <RelativeLayout android:layout_width="fill_parent" android:layout_marginTop="15dp" android:layout_height="match_parent"> <ImageView android:src="@drawable/screenshot" android:layout_width="80dp&qu

Android layout How to create a layout any suggestions please?

I have attached a layout file below how to create a layout like this. The list should be created at the runtime ? I can enable check box which ever required and when I click on submit button details should be saved. Any suggestions would be helpful for me. thanks in advance :) http://i.stack.imgur.com/zCp6X.jpg

Android layout Android centering an textview next to a imageview

I have an imageview and i want to put in the right a textview, but that will stay centered verticaly, so I can make my custom listview. This photo can explain better: My code <?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" android:gravity="top" > <ImageView android:id="@+id/imageView1" android:layout_width="

Android layout Using a button as a boolean switch

I'm trying to make a button in android function as a boolean switch. I want it to do something on the first click and do something else on the second click. On the third click, I want it to do the same thing on the first click et cetera. The main reason I want this due to the text element on the button that changes with each click. Switches and checkboxes have no texts to change. I've tried finding documentations on doing this online but can't seem to find any previous examples of doing this. W

Android layout How to bulk replace empty body tag (</TextView>) with empty end tag (/>)

I have got a project made in some old version of Eclipse. It is full of empty body tags, such as <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content"></EditText> I want to convert it to a empty end tag, which is the way I prefer. Want to get end tags like this <TextView android:layout_width="wrap_content" android:layou

  1    2   3   4   5   6  ... 下一页 共 6 页