Questions tagged [android-layout]

18336 questions
1

votes
2

answer
34

Views

ImageView can not be resized using the layout weight

I want to divide my screen into 3 vertically equal parts and add an ImageView to the top part. When I add the image, the parts won't be equal. It can not be changed using layout weight.
shayan malinda
1

votes
2

answer
52

Views

TextView not appearing on emulator and real device

This is how the design looked in Preview tab But when I run it on emulator or real device, valid until date not appearing. Thanks
AI.
1

votes
1

answer
45

Views

setting a custom margin between view of a recyclerview

I am trying to make recyclerview in which I can put a custom margin on view item based on an id in android I tried custome adapter with a different view which we can put in one recycler view but I need only one view and only want to do is put custom margin between view based on id. if (category_deta...
yuvrajsinh
1

votes
4

answer
6.8k

Views

Android certificate (can not install app by using apk file)

I developed an Android app. I then transferred the bin/myapp.apk to my android phone, and try to install it. But my phone says it can not be installed. Someone told me it is probably because of the Android certificate in my app is wrong. But I do not understand what is Android certificate ? Is it so...
Leem.fin
0

votes
3

answer
14

Views

Android LinearLayout doesn't look the same on an actual device

I am creating a custom digit pad for an Android app. I used several horizontal LinearLayout for that. Here is the code related to that part of the activity: Here you can see how this looks like in Android studio, and how it looks like on an actual device. I don't understand why is this happening. I...
user3362334
1

votes
2

answer
7.8k

Views

Multi connection via bluetooth in android

Hy , We are working on the android multiplayer game via bluetooth. It is a multiplayer LUDO game in which 4 player connect to each other and play the game. We are stuck in connection with the 3rd and 4th player connection. private OnMaxConnectionsReachedListener maxConnectionsListener = new OnMaxCon...
fahad Idrees
0

votes
0

answer
7

Views

How to force Margin-left (marginStart) to image in a fragment?

I have a statistic/history screen in my app, which shows the last 7 days history of user's activity. I've been using 7 fragments on the same screen to represent each day (7 days ago, 6 days ago....). On each fragment there is an image which should be changed, regarding the condition. The problem is...
Elie Dev
1

votes
3

answer
14k

Views

Place a image view and a Text view in same line

I have several logos and i want to set a Textview right next to it so that they are in the same line. I can't place them in the same line.please help me. I want my textview right next to my image. my layout
CraZyDroiD
1

votes
2

answer
3.8k

Views

How to programmatically change title bar colour to hex value?

Is it possible to change the colour of the title text within the action bar to a colour of a hex value? I'm only aware of the following and have no idea if this can be achieved: setTitleColor(Color.Green);
MacaronLover
1

votes
1

answer
1.1k

Views

RecyclerView's height 'match_parent' not working as expected whereas fixed height (1000dp,2000dp) is working

I'm working to make a cool layout like this: For this I'm using Android Parallax library from Github. This library is creating all the views (as shown in picture) from xml itself. But I want to create my own recyclerview, create adpaters, model classes and show them with cardview. I tried using car...
1

votes
5

answer
915

Views

Android splash screen stretches a logo on the full screen

I have a simple splash screen with a white background and the logo on the center of the screen. In a modern version of the Android, its work well but in 'old' versions of Android(for example API 22) my a logo is stretched on the full screen. How to make the logo splash screen look normal on all the...
Yur D
1

votes
2

answer
65

Views

ConstraintLayout - center TextView in the root but don't override Button

So my application supports different languages and I can't predict how long will be title TextView. I want to have back Button on the same line but I want to prevent Text to cover the button. There's an example what I mean: What's wrong with that: What I want to achieve: when text will 'meet' button...
Denathan
1

votes
3

answer
52

Views

How to remove gap on my adapter row layout

I have a layout row that is used on adapter like the following: My problem is, there is always a gap that separates between the large enough layouts. Even though I have removed all the padding, like the left and right padding. Is there something I don't see? In addition, the display is looked like t...
Nanda Z
1

votes
1

answer
65

Views

Android (Java): how to use LayoutInflater.inflate() for Dialogs?

I'm using the LayoutInflater within a Dialog and don't know what to set as a 2nd parameter, which is null for now. I found answers for onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle bundle), but that method isn't available for a Dialog. Faking the null by something like (ViewGroup) n...
Mr. B.
1

votes
5

answer
136

Views

How to set elevation color below the view in Android?

I am creating below design in Android Studio. But I stuck in how I can add color in elevation as seen in the picture below. A greenish color is shown below each button. I don't know how I can achieve this. I have even set the android:outlineSpotShadowColor and also this android:outlineAmbientShado...
1

votes
1

answer
267

Views

What is the difference between ?android:colorControlHighlight and ?colorControlHighlight

I see both ?android:colorControlHighlight and ?colorControlHighlight in our code base, and they seem to behave the same. According to References to theme attributes doc, the android part is optional. Are these indeed the same? If not, which one should be used where?
BenMQ
1

votes
1

answer
59

Views

Pass touch event from recycler to its parent LinearLayout

I have something like this : When the layout is scrolled to top, when the user makes a similar to 'swipe to refresh' move with his finger, I need to make a translate animation on Y axes. In other words, I need to follow the move of the finger the whole recycler if the recycler is on top. I tried t...
karvoynistas
1

votes
0

answer
110

Views

setContentView() not changing layout

I tried to change the layout of MainActivity from activity_main(xml) to firebase(xml) using setContentView(). The problem is that activity_main layout is still showing when the activity is on even though i have changed it to firebase layout. Here are my codes Before changing to firebase(xml) p...
johnson
1

votes
1

answer
32

Views

Android Layouts within layouts and making a slideable/scrollable strip within my android app

Im a beginner in android development and a bit stuck, I would like to have a strip in part of my main layout which gets dinamicaly filled and where the user can scroll it sideways to get the info while staying within the main layout. Im currently using a horizontal linearLayout and adding texViews t...
Jack
1

votes
0

answer
124

Views

in ReplacementSpan , when the text(content be drawn) is too long, and then the text is “… ” why

the follow code is PointReplaceSpan that want to draw blue circle in front of some text public class PointReplaceSpan extends ReplacementSpan { private final String TAG = 'PointReplaceSpan'; private boolean DEBUG = true; private int mMeasureWidth; private int mPointColor = 0xB33FBEFF; private Paint...
bankel
1

votes
2

answer
263

Views

Error: android.widget.LinearLayout cannot be cast to android.widget.ImageView

There was already someone else with a similar problem, but I couldn't understand the anwser and I wasn't able to add a coment to receive more informations. So please help me! This is my main JavaClass package ch.androidnewcomer.muckenfangfinal; import android.app.Activity; import android.app.Dialog...
Felix Hegg
1

votes
1

answer
23

Views

Views in Relativelayout inside a Fragment have extra spaces

I'm working on my landscape layout which is a RelativeLayout with a CardView, two ImageViews and a simple TextView. On the preview in Android Studio it looks exactly like what I want but if I test it on my real device it looks strange because there are always extra spaces. This is the preview in And...
Deno Agüero
1

votes
0

answer
66

Views

How to change the layout file in the activity?

I want to change the the XML file in my expandabl list view Adapter. But there is no OnCreate method. I saw a couple of Code samples with the OnCreate method. But is there a way to do it without it? I want to put it on my getGroupView method. In to the if-question. Sorry, but I'am new on Android St...
Mr Niceguy
1

votes
3

answer
142

Views

Why menu items in android studio don't work on click?

I'm developing a project on android and completely new to this. I had made a drawer menu with some of menu items. Now when i want to put another activity on click from menu items, the drawer closes automatically, it doesn't work. Here private DrawerLayout mdrawerLayout; private ActionBarDrawerToggl...
1

votes
1

answer
693

Views

Textview properties not showing in android studio

I'm a beginner and I'm new to android development. I can't modify the textview properties, even after manually modifying in XML it's not showing up. I tried clicking the blue arrows it's not showing anything. This is how it currently looks like: I want the properties to show like this: Edit1: Xml C...
datacrusader
1

votes
0

answer
166

Views

Why does a ConstraintLayout with layout_constraintDimensionRatio resize when data loads?

I'm trying to build a header data template to be populated with some text and a picture. I'd like its size to obey the 16:9 aspect ratio. This ConstraintLayout stays constrained to the height of the placeholder image, @dimen/profile_icon_size (72dp), while the async call is in progress. The placehol...
Ari Lacenski
1

votes
0

answer
44

Views

Status bar color change event

My question is simple. In the Android API is there any kind of event that is triggered when the status bar's color changes? If not, anyone has any ideas how to accomplish this? Root access is available but obviously it would be better to not use it. Thanks in advance.
FFY00
1

votes
0

answer
33

Views

trouble drawing custom views inside linearlayout

I'm working on a composite android component in an attempt to learn more about them. The structure is fairly simple, it contains a textview as a title, an editText view and a LinearLayout acting as a list. Most of this works fine, as everything shows up on screen. I can add any type of ordinary view...
user3069795
1

votes
1

answer
291

Views

In android Studio Image is not showing in preview

I'm using ImageView in AndroidStudio but AndroidStudio doesn't show my image in the preview. Please find the below screenshot:
faizal mohammed
1

votes
1

answer
219

Views

Getting song image very slow (MediaMetadataRetriever)

I am working on media player application i am getting song image using MediaMetadataRetriever and i am getting image and and i set using Glide but image takes about 7-9 sec to load that is very very slow. i also try using BitmapFactory but that also same time. so there is any faster way that can i...
Jigar Fumakiya
1

votes
0

answer
22

Views

Adding a Key Listener to ChipsInputEditText

Using a normal EditText, adding a key listener provides the expected behavior when my application runs. However, adding a key listener to the ChipsInputEditText using the MaterialChipsInput library, does not produce the expected behavior. The onKey method from the key listener does seem to be called...
1

votes
2

answer
100

Views

Differences between FrangmentTransaction and Intent

As taught by Udacity, typically one should use an intent to start a new activity (which presumably shows new/different information). But, for the project I'm currently working on I've been using FragmentTransaction to show different areas of the app. I figure this would lead to a smaller apk (b/c no...
1

votes
0

answer
65

Views

Button OnClickListener is not working when soft keyboard is visible

When the activity is launched, the user is prompted to enter in his email. A TextView and Button are visible along with keyboard. However, when the user taps on the button, it does not work - rather the keyboard disapears, then the user has to tap on the button again for it to work. Therefore, it ta...
fred shmed
1

votes
1

answer
49

Views

Defining only one screen density qualifier?

What happens when I define dimens.xml file only under values-hdpi directory in addition to the default values directory? does the system use it for higher densities as well (xhdpi, xxhdpi, ..) or does it use the default one?
y.allam
1

votes
0

answer
47

Views

android studio does not show my theme right

I have a problem when running android studio! It's not an error, rather an inconvenient. I did some projects in the past and when I open them now, my theme in the preview looks different, even though when i did the project the preview looked fine. Either my title bar is missing, or there is a mismat...
Maria Alexandra
1

votes
1

answer
133

Views

Adding Circular ImageView in circularMenu

I want to add the circular imageview in the middle of the ciruclarMenu https://i.stack.imgur.com/MPXAA.png .Here's the xml code: Here's the menu_items code : I am using this repository to make the circular menu 'https://github.com/szugyi/Android-CircleMenu' What Changes i need to do in above code to...
Logan
1

votes
2

answer
235

Views

SVG alter path without animation?

I have a battery icon I would like to 'animate' as in, change the length of the filling path to indicate battery percentage. However, android documentation for SVG's and SVG animation indicates you can only add predefined animations through xml. Is there a way to just simply alter the path of a SVG...
Rob van Dijk
1

votes
1

answer
261

Views

FragmentStatePagerAdapter view pager fragments not showing after activity recreate

When my Activity gets recreated via orientation change or if 'Don't keep activities' is turned on in developer settings, my ViewPager that has FragmentStatePagerAdapter doesn't recreate fragments. this is activity onCreate method: @Override protected void onCreate(@Nullable Bundle savedInstanceStat...
choki1708
1

votes
1

answer
179

Views

Layout content overlap in Oreo

I've two child layouts in ConstraintLayout (One above the other). It's showing second layout above first in all Android versions except Android 8.1 (Android O),where the second layout is hidden behind the first layout. Are there any changes that need to be done in Android O to get the same response...
Shahal
1

votes
0

answer
27

Views

Recycle View had the half of the height

I have a problem with this Recycle View on this layout, it don't take the complete height of your father container. I used the weight parameters, but that is not the problem i think. Check the code and Print screen. Thanks in advance. Layout
Javier Oliver

View additional questions