android-xml

Android Webview has extra white space at the bottom

為{幸葍}努か 提交于 2020-01-16 05:30:09
问题 I'm using the following method with HTML to load a local image into webview void loadingImage(WebView mWebView){ mWebView.getSettings().setSupportZoom(false); mWebView.getSettings().setDisplayZoomControls(false); String mHead="<html><head><style type='text/css'>body{margin:auto auto;text-align:center;} img{width:100%25;} </style></head>"; String mBody = "<body> <img src='my_image.jpg'/> </body></html>"; mWebView.loadDataWithBaseURL("file:///android_res/drawable/", mHead + mBody, "text/html",

Set buttons inline and break line to fit different devices

心已入冬 提交于 2020-01-15 09:13:18
问题 I want to add some buttons in a line and break it in a new line when they reach the end of the screen: If you know CSS, what I need is similar to display: inline-block rule. I am looking for a XML solution only, I want to avoid measuring the screen and buttons using java to emplace them below programatically. This is my current code, the following buttons are inside a ConstraintLayout : <Button android:id="@+id/boton1" android:layout_width="wrap_content" android:layout_height="wrap_content"

Set buttons inline and break line to fit different devices

。_饼干妹妹 提交于 2020-01-15 09:13:02
问题 I want to add some buttons in a line and break it in a new line when they reach the end of the screen: If you know CSS, what I need is similar to display: inline-block rule. I am looking for a XML solution only, I want to avoid measuring the screen and buttons using java to emplace them below programatically. This is my current code, the following buttons are inside a ConstraintLayout : <Button android:id="@+id/boton1" android:layout_width="wrap_content" android:layout_height="wrap_content"

Second layout is not showing with include tag in android studio

无人久伴 提交于 2020-01-14 07:59:10
问题 I have designed two Android layouts which should be shown in order. So, the first layout must be showing in top of the page and the second layout must be showing in bottom of the page. However, the following code only shows the first layout. How can I show the second layout too? the main layout is <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <include layout="

Android - shape on horizontal line

假装没事ソ 提交于 2020-01-13 10:56:26
问题 I have a xml , that in this xml I adding Horizontal Line between TextViews . I add a Shape to separator but I can't see changes. main_activity.xml : <TextView android:id="@+id/title" android:layout_width="match_parent" android:layout_height="20dp" android:text="HELLO" android:textColor="@android:color/black" /> <View android:id="@+id/vVerticalLine" android:background="@drawable/horizontal_shape" android:layout_width="match_parent" android:layout_marginLeft="50dp" android:layout_marginRight=

ExpandableListView inside a scrollview

最后都变了- 提交于 2020-01-12 10:00:09
问题 In my app i want to make a page that have ExpandableListView and below him CheckBox. My problem is that my ExpandableListView is too big and make the CheckBox out of the page. On smaller screens is not visible at all. I tried to put ExpandableListView inside scrollview but its not working. Is there a way to make my design? Here is my code and a screenshot. XML code: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout

Create, store and inflate custom layout in runtime

人盡茶涼 提交于 2020-01-12 05:31:07
问题 I'm trying to find a solution for the following problem. The application I work on requires a possibility for user to produce custom UI (layout of simple widgets) via custom UI builder. So, user may stack widgets (images, mostly. But TextViews and EditText, as well) on canvas, move them around, etc. UI have to be stored in a database for future use. So, there should be some mechanism for loading and inflating of this UI. This is the main problem. My first idea was to rely on standard Android

media player play pause in android

六眼飞鱼酱① 提交于 2020-01-11 09:45:42
问题 How can I make the Play and Pause image buttons look as a single image button. I am hereby attaching my code below. These are the images used. i Renamed play as start. import android.app.Activity; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ProgressBar; public class AudioView extends Activity{ MediaPlayer mp; Button p,pu,s,b,f,h,v,c,bu; ProgressBar

Android :: Settings Layout

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-07 07:11:11
问题 I need help... I got errors with my android xml... Here's the code: <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <CheckBoxPreference android:key="music" android:title="Music" android:layout_width="wrap_content" android:layout_height="wrap_content" android:summary="Play Music for each screen" android:defaultValue="true" /> <CheckBoxPreference android:key="hints" android:title="Hints" android:layout_width="wrap_content"

Round Border LinerLayout

≯℡__Kan透↙ 提交于 2020-01-06 09:06:07
问题 so the question How to add border around linear layout except at the bottom? answers my question partially but i cant seem to figure out how to make the corners round .. 回答1: Create a XML file named round_border in your layout folder. Now put this code in your XML file : <shape xmlns:android="http://schemas.android.com/apk/res/android"> <stroke android:width="4dp" android:color="#FF00FF00" /> <solid android:color="#ffffff" /> <padding android:left="7dp" android:top="7dp" android:right="7dp"