android-relativelayout

How to put RelativeLayout inside CoordinatorLayout

旧城冷巷雨未停 提交于 2019-11-28 23:15:45
I'm trying to recreate the search box as it is in Airbnb Android app. So I'm using CoorinatorLayout with Toolbar and RecyclerView . But when I insert something inside the Coordinator besides those two things, it doesn't show up. Here is my code: <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/slidingLayout" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout

Using layout_above in a RelativeLayout

和自甴很熟 提交于 2019-11-28 21:58:55
问题 Can someone explain to me why the ImageView is not appearing above the LinearLayout? <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content"> <LinearLayout android:id="@+id/rev_main" android:layout_width="fill_parent" android:layout_height="wrap_content"> <!-- some stuff in here --> </LinearLayout> <ImageView android:id="@+id/rev_arrow" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/arrow" android:layout_above="

Android Problems Converting ViewGroup with Children into Bitmap

眉间皱痕 提交于 2019-11-28 20:35:32
问题 I'm successfully converting a ViewGroup (RelativeLayout) into Bitmap using a Canvas. However, when the draw happens I only see the ViewGroup with its background drawable and not its children (two TextViews) who should be laid out within the RelativeLayout using rules like FILL_PARENT. The RelativeLayout is created using the following static function: public static RelativeLayout createProgrammeView(Context context, int width, int height, String title, String time) { RelativeLayout

Expand TextView with wrap_content until the neighbor view reaches the end of the parent

跟風遠走 提交于 2019-11-28 19:56:56
问题 I need to achieve the following layout: I have two TextViews in a relative layout: the green one is fixed text with wrap_content , the black one has dynamic text with wrap_content . The black text can change and become very long. I want the black TextView to expand with the text until the green view reaches the end of the parent. If that happens, the black TextView should stop expanding and ellipsize the end. How can I achieve that? What I tried: <RelativeLayout android:id="@+id/parent"

FrameLayout vs RelativeLayout for overlays

大兔子大兔子 提交于 2019-11-28 19:28:47
问题 I need to implement an overlay (translucent) screen for my app, something similar to Showcase View My guess was to use FrameLayout for this usecase, because it is used to stack items on top of each other. But I was surprised to see that the above library uses RelativeLayout . My question is when to use FrameLayout then, if not in cases like this? What are the disadvantages if I go the FrameLayout way? 回答1: A common rule of thumb when choosing layouts is to select the combination that results

Android: RelativeLayout in ScrollView

两盒软妹~` 提交于 2019-11-28 19:13:31
I have a RelativeLayout with multiple ImageView s and when I turn around the screen, the ImageView s become disordered. So I decided to wrap it into a ScrollView . But the ScrollView doesn't work! Can any one help me with that? I know that the right way is to design a GridView or ListView , but since I had some questions and no one answered me, I decided to go this way. Here is my xml code : <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ScrollView01" android:layout_width="match_parent" android:layout_height="match

What's the difference between alignBaseline and alignBottom in Android?

∥☆過路亽.° 提交于 2019-11-28 18:16:27
I tried both to align a few TextView objects and they gave me the same results. What exactly is the difference between 'baseline' and 'bottom' ? mrgnw To visualize the difference, I usually imagine two textboxes in Word or Photoshop. alignBottom lines up the bottom of the textboxes. (The blue outline) Text could be uneven, but the boxes they're in would line up on the bottom. alignBaseline aligns the actual text within the box. This can help ensure that the texts line up on the bottom, regardless of font size or textbox size. (The green line) What is a Baseline? Baseline is a typography term

Repeat Image in with ImageView in RelativeLayout

喜夏-厌秋 提交于 2019-11-28 17:29:13
问题 I want to repeat the image with ImageView with in RelativeLayout . Can it be possible to use the Bitmap xml and use tilemode "repeat" with RelativeLayout , because what I have seen things on Internet they all dealing with LinearLayout . Any help or tip will be warmly welcomed. 回答1: Create an XML file named background in Drawable folder background.xml <?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/imagename"

How to avoid overlap view in relative layout in android?

不想你离开。 提交于 2019-11-28 16:41:38
问题 <ScrollView 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" > <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentLeft=

What is the baseline in RelativeLayout?

那年仲夏 提交于 2019-11-28 06:40:01
What does "baseline" refer to when used in the context of a relative layout? Simple question, probably, but the documentation and google offer no hints. The term baseline comes from typography . It's the invisible line letters in text sit on. For example, imagine you put two TextView elements next to each other. You give the second TextView a big padding (say 20dp). If you add layout_alignBaseline to the second element, the text will "scoot up" to align with the baseline of the first element. The text from both elements will appear as if they were written on the same invisible line.