android-xml

Android Zig-Zag layout

久未见 提交于 2019-11-28 09:29:47
I'm in need of creating a receipt layout in Android. The idea is very simple, a rectangle layout with a zigzag top. Even, i have tried dashed line but nothing working. <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line"> <stroke android:color="#FF00" android:dashWidth="5dp" android:dashGap="5dp" /> </shape> Try with this: https://github.com/beigirad/ZigzagView Support top and bottom Zigzag. <ir.beigirad.zigzagview.ZigzagView android:layout_width="match_parent" android:layout_height="240dp" app:zigzagBackgroundColor="#8bc34a" app:zigzagElevation="8dp" app

Start Activity Intent on Clicking Text Inside Webview

青春壹個敷衍的年華 提交于 2019-11-28 08:50:45
I have a webview in my xml which goes like below: <WebView android:id="@+id/webView" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_width="match_parent" android:layout_height="match_parent"/> I am loading the webview like this: String webView_text = "Lorem ipsum..............**<a><u>Link to fire intent</u></a>**"; WebView webView= (WebView) findViewById(R.id.webView); webView.loadData(String.format(htmlText, webView_text), "text/html", "utf-8"); webView.setWebViewClient(new WebViewClient() { // Override URL public boolean shouldOverrideUrlLoading(WebView view

Add custom layout to toolbar

只愿长相守 提交于 2019-11-28 08:14:58
I followed this tutorial to give my app a regular toolbar with some tabs. I want to change the toolbar so it looks more like this: I want to add some text and images into the toolbar. How can I do this? activity_main.xml : <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width="match_parent"

'Failed to find style mapViewStyle' error persists

心已入冬 提交于 2019-11-28 07:18:54
问题 I've been working on this app for almost a year now (senior project) when it just decided to break a few days ago. My application has been developed using Eclipse version 3.7.2 64bit targeting Froyo Android 2.2, using my Windows 7 64bit pc. So far I have tried: rearranging the uses-library tag in the manifest file rewriting the map xml file deleting the R.java file and refreshing placing the mapview element within a layout reinstalling eclipse and the android-sdk cleaning the project creating

Gradient Radius as percentage of screen size

耗尽温柔 提交于 2019-11-28 06:15:01
I'm trying to create a shape drawable with radial gradient background, with radius that will adjust to the screen size (take a look at the relevant documentation ). This is my code: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:endColor="#000" android:gradientRadius="50%p" android:startColor="#5d2456" android:type="radial" /> </shape> But it doens't seem to work. if I remove the "%p", it works, but then the radius will be static, thus not adjusting to the screen size...Any idea what's wrong

Unknown attribute android:layout_width, layout_height, id, gravity, layout_gravity, padding

蹲街弑〆低调 提交于 2019-11-28 06:08:12
Getting Unknown attribute error on all android tag. In layout XML, Auto suggestion is not showing all attributes (like layout_width, layout_height, orientation, orientation & all others android attributes.) Here is a Snap shot Things i have done to resolve this issue. Clean Build & Rebuild Deleted .idea file Invalidated Caches/ Restart.. option Turn On Power Save Mode. SDk is up to date. In App Level Gridle apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.example.abhishek.ondemandservice" minSdkVersion 15

How to avoid space between imageview and gridview in linearlayout

偶尔善良 提交于 2019-11-28 05:50:39
问题 I have a image view and grid view in my .xml file. When I am executing this file its getting some space between grid view and image view. How to avoid this space...can any one help me to solve this problem. thanks in advance... my xml code is: android:layout_width="0px" android:layout_height="0px"> </Button> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">

i want to make my application only in landscape in android

天涯浪子 提交于 2019-11-28 04:38:32
I want to make my app work only in landscape mode but can't make it work. I have given screenOrientation = "landscape" even though the first page will be in landscape mode and other activity will be in portrait. XML FILE <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".Main" android:label="@string/app_name" android:screenOrientation="landscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent

showAsAction = “always” is ignored in Toolbar

こ雲淡風輕ζ 提交于 2019-11-28 04:26:39
问题 After switching to toolbar there is a problem with menu icons. Although I set for a menu item android:showAsAction="always" it does not show the icon, I can only find it clicking on the popup icon. This is myActivity public class myActivity extends AppCompatActivity{ ......... public void onCreate(....){ ............. Toolbar toolbar = (Toolbar) findViewById(....); setSupportActionBar(toolbar); } ............ public boolean onCreateOptionsMenu(Menu menu{ getMenuInflater().inflate(R.menu.menu,

Android button with different background colors

耗尽温柔 提交于 2019-11-28 03:40:55
i want to change the background-color of a button using a selector-xml-file. My approach is basically the one from the example at the bottom this page: http://developer.android.com/guide/topics/resources/color-list-resource.html i have a res/color/button_text.xml which looks like this: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:color="#ffff0000"/> <!-- pressed --> <item android:state_focused="true" android:color="#ff0000ff"/> <!-- focused --> <item android:color="#ff000000"/> <!--