Exception or error: Below is my table code. My screen looks like this http://imgur.com/dFP298o but I wanna make it looks like this http://imgur.com/YuYJiJx. How can I add borders around each row and around table layout? <TableLayout android:id=”@+id/table2″ android:layout_width=”fill_parent” android:layout_below=”@+id/test_button_text23″ android:layout_marginLeft=”45dp” android:layout_marginBottom=”25dp” android:layout_marginRight=”45dp” android:layout_height=”fill_parent” android:stretchColumns=”*” > <TableRow android:layout_width=”match_parent” android:layout_height=”match_parent” > <TextView android:gravity=”left” android:text=”Quantity” android:textStyle=”bold” /> <TextView …
Tag: layout
How to set the elevation of an AppBarLayout programmatically in the Android Support Library v24.0.0?-ThrowExceptions
Exception or error: When upgrading from the Android Support Library v23.4.0 to v24.0.0, setting the elevation to 0 programmatically to an AppBarLayout stopped working: appBayLayout.setElevation(0); It does work when setting the elevation in the XML. How to solve: Edit The AppBarLayout from v24.0.0 uses a StateListAnimator that defines the elevation depending on its state. So …
Android get layout height and width in a fragment-ThrowExceptions
Exception or error: I am working on a fragment and I want to get the dimension of a layout contained in the xml fragment layout. When I try the code RelativeLayout myLayout = view.findViewById(R.id.myLayout); myLayout.getHeight(); it returns 0. I need these dimensions to put inside myLayout other objects. I try to use: myLayout.getViewTreeObserver().addOnGlobalLayoutListener( new ViewTreeObserver.OnGlobalLayoutListener(){ …
change order of views in linear layout android-ThrowExceptions
Exception or error: As you know the order of views in linear layout is related to the order of them in xml file. Is it possible to change that order with java code by something like indexing? How to solve: I would try to remove all views with removeView(view) and add them with addView(childView, index) …
Android DrawerLayout doesn't show the right indicator icon-ThrowExceptions
Exception or error: I’m trying to use the new DrawerLayout for a list. The problem is though I set the drawer listener, the indicator on the actionbar is still the arrow icon instead of the 3-line icon which I intends to draw. The following is the OnCreate function: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_front_page); …
android – z-index in Relative layout-ThrowExceptions
Exception or error: I need to place a TextView above the Button in RelativeLayout. But it is not working: TextView is always under the Button, even if I move it before the button. I also tried bringChildToFront() function to move textview on front, but no luck. <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/rlBottom” android:layout_width=”fill_parent” android:layout_height=”match_parent”> <Button android:id=”@+id/bVio” android:layout_width=”wrap_content” android:layout_height=”50dip” …
layout – Can I use multiple shapes in one Android drawable?-ThrowExceptions
Exception or error: What I’m trying to do is define a common background for use in a LinearLayout which frequents my application on many of its Activitys. This particular layout is a header that shows on the top of each activity. What I’m trying to do is create a drawable that fills the linearlayout with …
android – DrawerLayout.openDrawer does not work the first time-ThrowExceptions
Exception or error: I am using a android.support.v4.widget.DrawerLayout in my activity. As long as I use the swipe gesture to open it, it works fine. However, when I want to open it through a button click by calling drawer.openDrawer(Gravity.LEFT), it does not work. But, if I open it once using the swipe gesture, after that …
android – Unexplained gap/padding to the left, between Toolbar, and LinearLayout-ThrowExceptions
Exception or error: I have the following structure in the layout file of my Android studio project, and I see unexplained left padding between the parent element (Toolbar) and it’s immediate child element (LinearLayout). Layout Text <Toolbar android:layout_width=”fill_parent” android:layout_height=”600dp” android:id=”@+id/toolbar” android:background=”#313B45″ android:weightSum=”1″> <LinearLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical”> <ImageView android:id=”@+id/headerimage” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:scaleType=”fitXY” android:layout_gravity=”left|top” android:layout_weight=”1″/> <TextView android:layout_width=”fill_parent” …