android-layout

How to hide bottom system bar in android tablet

不问归期 提交于 2020-01-13 10:25:50
问题 I am developing an application for tablet only, where the requirement is to run the app on the full screen of the tablet. For this I have used following code in my main activity: getWindow().requestFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); This code snippet only removes the title bar and action bar. But in tablets, there is a bottom system bar (having home and back button). I also want to

Divide the screen into SurfaceView and xml layout

懵懂的女人 提交于 2020-01-13 09:42:31
问题 MyActivity has setContentView(MySurfaceView) that covers all the screen. I would like to divide the screen into two parts: the first 2/3 of the screen must be occupied by MySurfaceView and the last 1/3 by my_activity_layout.xml . How can I do that? Thanks. EDIT Thanks for your answers, but I don't have how to apply them in my case. To be clear, these are my objects: 回答1: Solution: To attach an xml file in your layout, you can make use of the <include> tag. Reusing layouts is particularly

Divide the screen into SurfaceView and xml layout

落花浮王杯 提交于 2020-01-13 09:42:30
问题 MyActivity has setContentView(MySurfaceView) that covers all the screen. I would like to divide the screen into two parts: the first 2/3 of the screen must be occupied by MySurfaceView and the last 1/3 by my_activity_layout.xml . How can I do that? Thanks. EDIT Thanks for your answers, but I don't have how to apply them in my case. To be clear, these are my objects: 回答1: Solution: To attach an xml file in your layout, you can make use of the <include> tag. Reusing layouts is particularly

Android: Align LinearLayout center for all screen sizes

蹲街弑〆低调 提交于 2020-01-13 09:37:08
问题 I want to design a layout for my login screen, I tried the following codes. Using some hardcoded values I got my center green color layout center for some screen sizes. I know using hardcoded values wont work on different screen sizes. I tried numerous stuffs on SO. Please provide me the best way <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background

TableLayout with layout_width=matchparent not matching parent

£可爱£侵袭症+ 提交于 2020-01-13 07:51:27
问题 I have a tableLayout with two columns and two rows, both rows and the last column have match_parent for width but the layout isn't filling the parent width, it comports itself like it had wrap_content. Here is the code: <TableLayout android:layout_width="match_parent"> <TableRow android:layout_width="match_parent"> <TextView android:layout_width="wrap_content" android:text="static" /> <EditText android:layout_width="match_parent" android:text="text" /> </TableRow> <TableRow android:layout

Android Studio shows warning: Element merge is not allowed here

北慕城南 提交于 2020-01-13 07:50:35
问题 I create custom view based on LinearLayout. Class extends the LinearLayout class, in layout I have: <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android"> <merge> some staff here </merge> </layout> Android Studio shows the the warning Element merge is not allowed here , but app works. What's wrong? 回答1: I believe it's just a glitch in Android studio. Even the official documentation has merge as a direct child of layout : https://developer

Detect if TextView spans over 2 lines

旧时模样 提交于 2020-01-13 07:36:06
问题 I wonder if there are any ways to detect either if string to be fitted into a text view reaches the end of screen and therefore change line, or if a textview spans over 2 lines? I want to know this so I can increase margins between some textviews if a textview spans over 2 lines, of course I want to do this dynamically. 回答1: TextView supports getLineCount() - See docs careful as you may need to check if the view has been drawn first. 来源: https://stackoverflow.com/questions/13444060/detect-if

Android ActionBar pattern - multiple activities or fragments

最后都变了- 提交于 2020-01-13 06:04:39
问题 There are few similar questions on stackoverlow, but I haven't find clear explanation at any of the answers how to implement Action Bar pattern for more complex/multiple activities apps. As I understand, there are two options to do this: 1.) implement multiple activities and in each of them implement/include action bar --> problem with this is that when ever you lunch new activity, although it has the same looking action bar, it has that transition, and jumps through the screen, so it's

Android ActionBar pattern - multiple activities or fragments

时光毁灭记忆、已成空白 提交于 2020-01-13 06:04:18
问题 There are few similar questions on stackoverlow, but I haven't find clear explanation at any of the answers how to implement Action Bar pattern for more complex/multiple activities apps. As I understand, there are two options to do this: 1.) implement multiple activities and in each of them implement/include action bar --> problem with this is that when ever you lunch new activity, although it has the same looking action bar, it has that transition, and jumps through the screen, so it's

Insert 3 images dynamically to horizontal scrollview or Viewpager

我怕爱的太早我们不能终老 提交于 2020-01-13 05:35:19
问题 There is an image shown below for what I am looking for. Currently I am using view pager & circle indicator. In view page it is showing only a single image. I want in one viewpager three images as shown in pic. When I slide that page, again three different images loaded form server with text below. How to do this? Any idea regarding this or any other way to achieve this? My code is shown below. I add some xml layout here: homespizzaview.xml <LinearLayout android:id="@+id/linearLayoutbutton"