I am new with Android Studio and having problem with setting the attributes e.g. The ID, adjust the constraints etc., simply because the attributes are not displayed in the attributes panel. I have tried deleting the recyclerview and re inserting them, restarting Android Studio, and even rebooting to no avail. I understand that I can set these attributes manually in the XML file but I would prefer to do it within the attributes panel.
use this to see atributes
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:orientation="horizontal"
tools:layoutManager="android.support.v7.widget.LinearLayoutManager"
tools:listitem="#layout/view_item" />
At the corner of the left bottom, you can see design and text, Now you are in design mode click on text mode to get exactly what you want.
Thanks.
And try this to make sure it is working properly
File > Invalidate Caches > Restart
I solved this problem by just restarting Android Studio !!!
Related
Can anybody how to remove this parent NavDrawer overlay showing whilst designing layout? (Screen 1).
The overlay is removed when running in actual device (Screen 2).
Because of this I can't design child elements right there in the studio.
Any help would be great!
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible">
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Always Visible."
/>
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
When you see that gray block with the tag name in it, that means that Android Studio can't resolve the class from the tag in your layout, so it doesn't know what to preview. Often this will happen if you have a typo in your layout file, but then you wouldn't see it working when you actually run the app.
For me, I can make this happen quite easily by using the old support library versions of widgets, since I have AndroidX enabled in my project. For example, just pasting your code in to my IDE gives me the same gray box, but changing your tags to use AndroidX fixes it (android.support.v4.widget.DrawerLayout -> androidx.drawerlayout.widget.DrawerLayout).
Chances are good that your Android Studio just needs a kick in the pants.
I suggest doing a Gradle Sync (File -> Sync Project with Gradle Files) and, if that doesn't work, an Invalidate + Restart (File -> Invalidate Caches / Restart...).
so i've learning a little about android studio recently, but every video i see, when they modify something from the "properties" window i have issues because mine says "atributes" and misses a lot of properties.
Does anyone know how to make it appear?
I have already tried a lot of stuff, like Window > restore default layout, also deleting the workspace, reinstalling android studio but i cant make it work.
I'll leave an imagen to show how i see it
https://gyazo.com/0cd32a07cefde36bb3fbbdaff5a9dff2
But every video i see has this
https://gyazo.com/300f41730bf495d8e0db05cb55d7f8d1
look at how many properties they have vs what i have, i already pressed the "view all atributtes" button
Thanks!
In Android studio 3.4.1 View -> Enter presentation mode then "attributes windows shows"
To see the "attributes" table, you only need to check the "gear" icon on that window and select "All attributes table" instead of "XML attribute table".
For more details you can check
https://developer.android.com/studio/write/layout-editor
I went into activity_main.xml, manually changed the text size of a button:
<TextView
android:id="#+id/text_view_p1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Player 1: 0"
android:textSize="30sp" />
Then I changed it back to the original size. Attributes window magically appeared again. Before I tried that, nothing else worked
So I have been developing this layout using a ConstraintLayout inside a ScrollView. It works fine, but now I have hit a problem. I have to expand the layout outside the screen. I can scroll in Design mode, but I cannot add anything without it getting stuck to the top. The constraints are for earlier objects, not the current one I'm adding.
I can add constraints in Blueprint mode, but it looks like I cannot scroll the ScrollView in blueprint mode. Is this even possible? Using Android Studio 2.2(release) and constraint-layout:1.0.0-alpha8
I tried doing it like in Design mode, but it doesn't scroll. Any ideas?
Scrolling normally with ConstraintLayout causes the constraints to stay in the same location.
EDIT:
Updated to alpha9 but still does not solve it
EDIT 2:
beta1 does not work either. AS 2.2.2.
EDIT 3:
Sample layout:
<Button
android:text="Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/sampleButton"
/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="HardcodedText">
<android.support.constraint.ConstraintLayout
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- ETC constraints -->
</android.support.constraint.ConstraintLayout>
</ScrollView>
In android studio 2.2 update, it includes scrolling in design and blueprint mode by default. click on design mode in the preview pane and try to scroll your screen it will start scrolling. There is another option of blueprint in that mode it shows you the blueprint of the design and by doing same for this will help you scroll in blueprint mode also.
Put the Scroll view outside of the Constraint layout. Then use this [Red mark] to drag the view and it will make a custom device editor to you. When you have done, change back to the device editor [Beside rotation icon]...
In latest android studio 2.2.2 version with constraint-layout:1.0.0-beta1 you can scroll blueprint
for better working, after updating constraint-layout please restart android studio (invalidate caches)
Not yet.
Maybe try to have a separate file to edit the content instead, and use an include in the file where you have the ScrollView?
As of ConstraintLayout 1.0.1 scrolling scrolls the constraints. Meaning it is possible to scroll a ConstraintLayout in blueprint mode and it functions as expected. It works at Android Studio 2.3.2 and up (I haven't older versions).
Now when scrolling, both the visible view, the border, and constraints move along with the drawn button.
beta1 version has been released. I doubt this is fixed, but check it out.
You can ask for a bugfix for this here: http://tools.android.com/feedback
PS: you are trying to scroll using the mouse scroll wheel, right? hehe just checking... I say that because just recently I figured out I could scroll in the design mode using the mouse wheel.. duhh haha. I never tried in blueprint mode though.
My issue is similar to this but Android Studio doesn't tell me anything about a rendering issue or compiler/build errors(I was able to build fine).
Here is what I am seeing(this is a new project)
And the contents of content_main.xml
After reading on different rendering issue threads, I I've tried rebuilding, cleaning, invalidate caches/restart and even starting a new project to see if the layout preview was working(Still empty)
I also played around with different sdk versions(20,19) to see if the layout preview was working but all I got was this quirky issue that I don't think would cause the layout preview to not work.
Does anyone know what my problem is here? I didn't mess around with my initial Gradle files and remove any support library dependencies. Another solution I had in mind was reinstalling Android Studio but that's last resort.
Just check your sdk valid version like example.
Try putting your TextView element into an empty FrameLayout:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/my_groups" />
</FrameLayout>
This code above should be put inside your RelativeLayout. Hope it helps.
I'm having trouble with eclipse ADT plugin. Everything was ok in Eclipse's layout editor, in both graphical and XML modes. I designed the GUI mostly from the graphical editor, for convenience.
At some point the Properties view broke. Now it only shows properties for the "View" class, and every other property from View subclasses are not shown (for instance, properties of ImageView are not shown). Properties for aligning inside RelativeLayout are also missing (for instance alignParentTop).
This is a "clean" eclipse install I use only for android, there are no other plugins installed (other than subeclipse). It has never failed me before. I've updated the SDK and also the plugin to the last version but it didn't fix this problem. Eclipse is v3.7 Indigo R2.
Also tried cleaning the project to no avail.
Have you seen this behaviour before? Is it possible to get the graphical editor back and fully working as expected without reinstalling everything again?
Thanks in advance.
UPDATED:
I've traced the problem to a single layout XML. Other layout XMLs are working fine. And the problem is that I'm using the DrawerLayout as main layout:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android">
If I replace this layout for a regular LinearLayout everything returns back to normal. Still I've to find a solution, because every modificattion attempted on the graphical layout results in that element being removed. So this is probably a bug and not only it is inconvenient but also dangerous!
I had the same problem and managed to fix it by splitting the content of the DrawerLayout out into different files like this:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- The main content view -->
<include layout="#layout/activity_tab_content"/>
<!-- The navigation drawer -->
<include layout="#layout/navigation_drawer"/>
</android.support.v4.widget.DrawerLayout>
Now I can edit the content of the drawer successfully in a separate editor.